Skip Headers

# Mapping to Simple and Complex Types

Previous

Next

Consider the XML document shown in Example: XML Document.

XML Document

    <EMPLOYEE ID="123">
        <NAME>Jane Doe</NAME>
        <ADDRESS>
            <STREET>123 Any St.</STREET>
            <CITY>MyCity</CITY>
        </ADDRESS>
    </EMPLOYEE>

In general, using TopLink XML mappings, you can map a Java class to a simple type (such as `NAME`) or to a complex type (such as `ADDRESS`).

Specifically, you can map a Java object's simple attributes to XML attributes (such as `ID`) and text nodes (such as `NAME`). You can also map a Java object's relationships to XML elements (such as `ADDRESS`).

Table: XML Mapping Support for XML Simple and Complex Types summarizes the XML simple and complex types supported by each TopLink XML mapping.

XML Mapping Support for XML Simple and Complex Types

Mapping | XML Attribute | XML Text Node | XML Element
--- | --- | --- | ---
XML Direct Mapping |  |  |
XML Composite Direct Collection Mapping |  |  |
XML Composite Object Mapping |  |  |
XML Composite Collection Mapping |  |  |
XML Any Object Mapping |  |  |
XML Any Collection Mapping |  |  |
XML Transformation Mapping |  |  |