JAXB XJC compiler disregarding mixed=true on XML Schema documents

XJC seems to be completely ignoring mixed="true" on my XML Schema elements thereby not allowing me to extract text content. From the sample XML below, I need to be able to extract "Title Text." Without mixed="true" being recognized, no accessor is created nor is it unmarshalled from XML:

<?xml version="1.0" encoding="UTF-8"?>
<title xmlns="urn:hl7-org:v3" integrityCheck="true">Title Text</title>

Here's a complete but minimized schema that demonstrates the problem:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema targetNamespace="urn:hl7-org:v3"

  <xs:complexType name="ST" mixed="true">
         <xs:restriction base="ED">
               <xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="0"/>
               <xs:element name="thumbnail" type="xs:string" minOccurs="0" maxOccurs="0"/>
            <xs:attribute name="compression" type="xs:string" use="prohibited"/>

  <xs:complexType name="ED" mixed="true">
      <xs:extension base="BIN">
          <xs:element name="reference" type="xs:string" minOccurs="0" maxOccurs="1" />
          <xs:element name="thumbnail" minOccurs="0" maxOccurs="1" type="xs:string" />
        <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:complexType name="BIN" abstract="true" mixed="true">
      <xs:extension base="ANY">
        <xs:attribute name="representation" use="optional" type="xs:string" default="TXT" />

  <xs:complexType name="ANY" abstract="true">
    <xs:attribute name="nullFlavor" type="xs:string" use="optional" />

  <xs:element name="title" type="ST" />

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 the XmlMixed annotation, nor a value or contents accessor:

 * <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>
@XmlType(name = "ST")
public class ST
    extends ED

Why is XJC / JAXB completely disregarding my mixed content fields? I have tried both JAXB 2.1 and JAXB 2.2 but only trivial differences are present in the generated code.

Note: I can't change the schema as the actual schema is a standards-compliant healthcare (HL7) schema.


  • After more research I could do nothing but conclude it was a bug which I filed. It was acknowledged as JAXB issue #792.