Skip Headers

# Mapping an xsd:list Type

Previous

Next

You can map a Java attribute to an `xsd:list` type, such as:

    <xsd:simpleType name="sizes">
        <xsd:list itemType="xsd:int"/>
    </xsd:simpleType>

If you represent the `xsd:list` in your object model as a Java `List` type, use an `EISCompositeDirectCollectionMapping` (with XML records) or an `XMLCompositeDirectCollectionMapping` and use mapping method `useCollectionClass` to specify the `List` type of the Java attribute.

If you represent the list in your object model as a `String` of white space delimited tokens (for example, `"aaa bbb ccc"`), use an `EISDirectMapping` (with XML records) or an `XMLDirectMappng` to map this Java attribute to an `xsd:list` (for example, `<item>aaa bbb ccc</item>`).

In either case, you can configure whether or not the mapping unmarshalls (writes) the list to a single node, like `<item>aaa bbb ccc</item>`, or to multiple nodes, such as the following:

    <item>aaa</item>
    <item>bbb</item>
    <item>ccc</item>

For more information on mapping to an `xsd:list` type using an `XMLCompositeDirectCollectionMapping`, see:

- "Mapping to a Single Text Node With an XML Composite Direct Collection Mapping"

- "Mapping to a Single Attribute With an XML Composite Direct Collection Mapping"

- "Specifying the Content Type of a Collection With an XML Composite Direct Collection Mapping"

The same applies to an `EISCompositeDirectCollectionMapping` (with XML records).

For more information about mapping to an `xsd:list` type using an `XMLDirectMapping`, see "Mapping to a List Field With an XML Direct Mapping". The same applies to an `EISDirectMapping` with XML records (see "EIS Direct Mapping").