Skip Headers

# Mapping to a Sequence in a Subelement

Previous

Next

Given the XML schema in Example: Schema for Composite Direct Collection XML Mapping to a Subelement Sequence, Figure: Composite Direct Collection XML Mapping to a Subelement Sequence illustrates a composite direct collection XML mapping to a sequence of text nodes in a subelement in a corresponding XML document. Example: Java for Composite Direct Collection XML Mapping to a Subelement Sequence shows how to configure this mapping in Java.

Schema for Composite Direct Collection XML Mapping to a Subelement Sequence

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="employee" type="employee-type"/>
        <xsd:complexType name="employee-type">
            <xsd:sequence>
                <xsd:element name="tasks">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="task" type="xsd:string" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:schema>

Composite Direct Collection XML Mapping to a Subelement Sequence

Description of "Composite Direct Collection XML Mapping to a Subelement Sequence"

Java for Composite Direct Collection XML Mapping to a Subelement Sequence

    XMLCompositeDirectCollectionMapping tasksMapping = new XMLCompositeDirectCollectionMapping();
    tasksMapping.setAttributeName("tasks");
    tasksMapping.setXPath("tasks/task/text()");