Skip Headers

# Mapping to an Attribute

Previous

Next

Given the XML schema in Example: Schema for XML Direct Mapping to Text Node by Position, Figure: XML Direct Mapping to Text Node by Position illustrates an XML direct mapping to a text node by position in a corresponding XML document. Example: Java for XML Direct Mapping to Text Node by Position shows how to configure this mapping in Java.

Schema for XML Direct Mapping to an Attribute

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="customer" type="customer-type"/>
        <xsd:complexType name="customer-type">
            <xsd:attribute name="id" type="xsd:integer"/>
        </xsd:complexType>
    </xsd:schema>

XML Direct Mapping to an Attribute

Description of "XML Direct Mapping to an Attribute"

Java for XML Direct Mapping to an Attribute

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("id");
    idMapping.setXPath("@id");