XJC seems to be completely ignoring mixed="true" on my XML Schema elements. I have a type ST that's a restriction on type ED that extends BIN which is abstract and extends type ANY, also abstract. It can be seen in the following minimized version of the schema:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema targetNamespace="urn:hl7-org:v3"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns="urn:hl7-org:v3"
xmlns:mif="urn:hl7-org:v3/mif"
elementFormDefault="qualified">
<xs:complexType name="ST" mixed="true">
<xs:complexContent>
<xs:restriction base="ED">
<xs:sequence>
<xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="0"/>
<xs:element name="thumbnail" type="xs:string" minOccurs="0" maxOccurs="0"/>
</xs:sequence>
<xs:attribute name="compression" type="xs:string" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ED" mixed="true">
<xs:complexContent>
<xs:extension base="BIN">
<xs:sequence>
<xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="thumbnail" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:sequence>
<xs:attribute name="compression" type="xs:string" use="optional" />
<xs:attribute name="integrityCheck" type="xs:string" use="optional" />
<xs:attribute name="integrityCheckAlgorithm" type="xs:string" use="optional" default="SHA-1" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="BIN" abstract="true" mixed="true">
<xs:complexContent>
<xs:extension base="ANY">
<xs:attribute name="representation" use="optional" type="xs:string" default="TXT" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ANY" abstract="true">
<xs:attribute name="nullFlavor" type="xs:string" use="optional" />
</xs:complexType>
<xs:element name="title" type="ST" />
</xs:schema>
Note that in the above I have mixed="true". Despite that, the generated schema fragment doesn't contain a reference to it, nor does the generated class use XmlMixed:
/**
* <p>Java class for ST complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ST">
* <complexContent>
* <restriction base="{urn:hl7-org:v3}ED">
* <sequence>
* <element name="reference" type="{
http://www.w3.org/2001/XMLSchema}string" maxOccurs="0" minOccurs="0"/>
* <element name="thumbnail" type="{
http://www.w3.org/2001/XMLSchema}string" maxOccurs="0" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ST")
public class ST
extends ED
{
}
Why is XJC / JAXB completely disregarding my mixed content fields? I can't change the schema as the instance documents will come from many sources.
Thanks for any suggestions.
--
Kaleb Pederson
Blog - http://kalebpederson.com
Twitter - http://twitter.com/kalebpederson