Skip Headers

# Mapping Into the Parent Record

Previous

Next

The composite object may be mapped to the same record as the parent.

Note: The nodes mapped to by the composite object must be sequential.

Given the XML schema in Example: Schema for XML Composite Object Mapping into the Parent Record, Figure: XML Composite Object Mapping into the Parent Record illustrates an XML composite object mapping into the parent record in a corresponding XML document. Example: Java for XML Composite Object Mapping into the Parent Record shows how to configure this mapping in Java.

Schema for XML Composite Object Mapping into the Parent Record

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="customer" type="customer-type"/>
        <xsd:complexType name="customer-type">
            <xsd:sequence>
                <xsd:element name="first-name" type="xsd:string"/>
                <xsd:element name="last-name" type="xsd:string"/>
                <xsd:element name="street" type="xsd:string"/>
                <xsd:element name="city" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:schema>

XML Composite Object Mapping into the Parent Record

Description of "XML Composite Object Mapping into the Parent Record"

Java for XML Composite Object Mapping into the Parent Record

    XMLCompositeObjectMapping addressMapping = new XMLCompositeObjectMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setXPath(".");
    addressMapping.setReferenceClass(Address.class);