Skip Headers

# Mapping to a Single Attribute With an XML Composite Direct Collection Mapping

Previous

Next

Given the XML schema in Example: Schema for XML Composite Direct Collection Mapping to a Single Attribute, Figure: XML Composite Direct Collection Mapping to a Single Attribute illustrates a composite direct collection XML mapping to a single attribute in a corresponding XML document. Example: Java for XML Composite Direct Collection Mapping to a Single Attribute shows how to configure this mapping in Java.

Schema for XML Composite Direct Collection Mapping to a Single Attribute

    <?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:attribute name="tasks" type="tasks-type"/>
        </xsd:complexType>
        <xsd:simpleType name="tasks-type">
            <xsd:list itemType="xsd:string"/>
        </xsd:simpleType>
    </xsd:schema>

XML Composite Direct Collection Mapping to a Single Attribute

Description of "XML Composite Direct Collection Mapping to a Single Attribute"

Java for XML Composite Direct Collection Mapping to a Single Attribute

    XMLCompositeDirectCollectionMapping tasksMapping = new XMLCompositeDirectCollectionMapping();
    tasksMapping.setAttributeName("tasks");
    tasksMapping.setXPath("@tasks");
    tasksMapping.setUsesSingleNode(true);