Skip Headers

# all, choice, or sequence Structure

Previous

Next

You can use the `jaxb:class` customization with an `all`, `choice`, or `sequence` structure. Example: jaxb:class Customization of an all Structure shows a `jaxb:class` customization of an `all` structure.

jaxb:class Customization of an all Structure

    <xsd:element name="employee">
        <xsd:complexType>
            <xsd:all>
                <xsd:annotation>
                    <xsd:appinfo>
                        <jaxb:class name="period"/>
                    </xsd:appinfo>
                </xsd:annotation>
                <xsd:element name="startDate" type="xsd:date"/>
                <xsd:element name="endDate" type="xsd:date"/>
            </xsd:all>
        </xsd:complexType>
    </xsd:element>

This directs the JAXB compiler to create an inner class named `Period` in the owning element's class for the `all` structure. Use an `EISCompositeObjectMapping` (with XML records) or an `XMLCompositeObjectMapping` to map a Java attribute to this inner class.

For more information, see "XML Composite Object Mapping". The same applies to an `EISCompositeObjectMapping` with XML records (see "EIS Composite Object Mapping").