I am trying to include a text file content into an xml file. I am using the following files. I am getting UnmarshalException on the bar property. Please advice. Many thanks.
thankyou.properties file
Thank you
XML file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE doc [
<!ELEMENT bar (#PCDATA)>
<!ENTITY otherFile SYSTEM "thankyou.properties">
]>
<doc>
<foo>
<bar>&otherFile;</bar>
</foo>
</doc>
My XSD
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="doc">
<xs:complexType>
<xs:sequence>
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="bar"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Java model
@XmlRootElement(name = "doc")
@XmlAccessorType(XmlAccessType.FIELD)
public class Foo {
@XmlElement(name = "bar")
private String bar;
}
The exception I get is
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"bar"). Expected elements are <{