Skip Headers

# Limitations of jaxb:class Customization Support

Previous

Next

When mapping to jaxb:class customized structures, consider the following limitations:

- Unbounded structures are not supported.

- Partial validation is not supported.

- When mapping sequence elements to a composite object, the XML schema must order the elements so that the elements you map to the composite object are kept together.

  The `sequence` structure forces all elements to occur in the order in which they are specified in the XML schema. Consider the XML schema shown in Example: XML Schema With Unsupported Sequence Element Order. A valid XML instance must contain the sequence elements in the specified order:

  `street`, `customerName`, `city`

  In this example, you want to map the `customerName` attribute with a direct mapping and you want to map the `street` and `city` attributes to a composite `Address` object. Depending on the order in which you define the mappings, TopLink will marshall invalid XML document instances in the order

  `customerName`, `street`, `city`

  or

  `street`, `city`, `customerName`.

  XML Schema With Unsupported Sequence Element Order

      <xs:element name="customer">
          <xs:complexType>
              <xs:sequence>
                  <xs:element name="street" type="xs:string"/>
                  <xs:element name="customerName" type="xs:string" />
                  <xs:element name="city" type="xs:string"/>
              </xs:sequence>
          </xs:complexType>
      </xs:element>

  To correct this problem, modify the XML schema to keep the elements you want to map to the composite object together (see Example: XML Schema With Supported Sequence Element Order) and define the mappings in the order specified by the XML schema.

  XML Schema With Supported Sequence Element Order

      <xs:element name="customer">
          <xs:complexType>
              <xs:sequence>
                  <xs:element name="customerName" type="xs:string" />
                  <xs:element name="street" type="xs:string"/>
                  <xs:element name="city" type="xs:string"/>
              </xs:sequence>
          </xs:complexType>
      </xs:element>