Hello folks,
I'm looking for help with using the JAXB api. I'm having trouble with an Mixed content element. JAXB properly reads in all the defined elements, but ignores any straight text. The W3C XML Schema says that it is possible to mix text with elements, so obviously either I'm doing something wrong with my schema or JAXB is conveniently ignoring the capability.
ie (using fictitious elements):
The JAXB compiler does properly compile the schema, and the program runs, I just don't get the data coming through correctly.
My one idea as to what is going on is that the program can't find a relevant element class for the string element, but I don't know where I might find that to put in.
Further, if I just use a <mixedElement>This is some text</mixedElement> it throws a JAXBException stating that the element is closed unexpectedly.
Any way, all help would be appreciated.
--- Relevant snippet of schema file
--- Original test data
--- Output from Marshalling the element tree to System.out
I'm looking for help with using the JAXB api. I'm having trouble with an Mixed content element. JAXB properly reads in all the defined elements, but ignores any straight text. The W3C XML Schema says that it is possible to mix text with elements, so obviously either I'm doing something wrong with my schema or JAXB is conveniently ignoring the capability.
ie (using fictitious elements):
<mixedElement>
This gets ignored.
<string>this does not</string>
</mixedElement>
The JAXB compiler does properly compile the schema, and the program runs, I just don't get the data coming through correctly.
My one idea as to what is going on is that the program can't find a relevant element class for the string element, but I don't know where I might find that to put in.
Further, if I just use a <mixedElement>This is some text</mixedElement> it throws a JAXBException stating that the element is closed unexpectedly.
Any way, all help would be appreciated.
--- Relevant snippet of schema file
<xsd:complexType name="BlockType">
<xsd:attribute name="mimeType" type="xsd:string" />
<xsd:attribute name="id" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="ParagraphType" mixed="true">
<xsd:complexContent>
<xsd:extension base="BlockType" >
<xsd:sequence>
<xsd:any minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="lang" type="xsd:string" default="EN"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="paragraph" substitutionGroup="block" type="ParagraphType" />
--- Original test data
<page title="Test run">
<paragraph>
this is a test.
<link url="http://www.athabascau.ca/" label="Athabasca University" /> La, A further test.
<image url="http://sakir.snikte.net/cg/draft.jpg" label="hot off the renderer" width="320" height="320"/>
testing.
</paragraph>
</page>
--- Output from Marshalling the element tree to System.out
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<page title="Test run">
<paragraph>
<link label="Athabasca University" url="http://www.athabascau.ca/"/>
<image label="hot off the renderer" url="http://sakir.snikte.net/cg/draft.jpg" height="320" width="320"/>
</paragraph>
</page>
