Jump to: navigation, search

Configuring an XML Mapping (ELUG)

For information on how to create EclipseLink mappings, see Creating a Mapping.

This table lists the types of XML mappings that you can configure and provides a cross-reference to the type-specific chapter that lists the configurable options supported by that type.

Mapping Type See...

XML Direct Mapping

Configuring an XML Direct Mapping

XML Composite Direct Collection Mapping

Configuring an XML Composite Direct Collection Mapping

XML Composite Object Mapping

Configuring an XML Composite Object Mapping

XML Composite Collection Mapping

Configuring an XML Composite Collection Mapping

XML Any Object Mapping

Configuring an XML Any Object Mapping

XML Any Collection Mapping

Configuring an XML Any Collection Mapping

XML Transformation Mapping

Configuring an XML Transformation Mapping

XML Object Reference Mapping

Configuring an XML Object Reference Mapping

XML Collection Reference Mapping

Configuring an XML Collection Reference Mapping

XML Binary Data Mapping

Configuring an XML Binary Data Mapping

XML Binary Data Collection Mapping

Configuring an XML Binary Data Collection Mapping

XML Fragment Mapping

Configuring an XML Fragment Mapping

XML Fragment Collection Mapping

Configuring an XML Fragment Collection Mapping

XML Choice Object Mapping

Configuring an XML Choice Object Mapping

XML Choice Collection Mapping

Configuring an XML Choice Collection Mapping

XML Any Attribute Mapping

Configuring an XML Any Attribute Mapping

For more information, see the following:


Configuring Common XML Mapping Options

This table lists the configurable options shared by two or more XML mapping types. In addition to the configurable options described here, you must also configure the options described for the specific XML Mapping Types, as shown in this table:


Option EclipseLink Workbench Java

Configuring XPath

Supported

Supported

Configuring Reference Descriptor

Supported

Supported

Configuring Container Policy

Supported

Supported

Configuring Method or Direct Field Accessing at the Mapping Level

Supported

Supported

Configuring a Mapping

Supported

Supported

Configuring Maps to Wildcard

Supported

Unsupported

Configuring a Serialized Object Converter

Supported

Supported

Configuring a Type Conversion Converter

Supported

Supported

Configuring an Object Type Converter

Supported

Supported

Configuring a Simple Type Translator

Supported

Supported

Configuring the Use of a Single Node

Supported

Supported

Configuring the Use of CDATA

Unsupported

Supported

Configuring Reference Class

Unsupported

Supported

Configuring the Use of Inline Binary Data

Unsupported

Supported

Configuring the Use of SwaRef Type

Unsupported

Supported

Configuring Source to Target Key Field Association

Unsupported

Supported

Configuring the Choice Element

Unsupported

Supported


Configuring Reference Descriptor

For XML attributes that reference other descriptors (instead of a schema element), you may select a specific reference descriptor. If you do not specify a reference descriptor, EclipseLink uses the xsi:Type attribute to determine the reference class object.

This table summarizes which XML mappings support reference descriptor configuration.

XML Mapping Support for Reference Descriptor Configuration

XML Mapping Using the Workbench
Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Supported

Supported

XML composite collection mapping

Supported

Supported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Unsupported

XML object collection mapping

Unsupported

Unsupported

XML binary data mapping

Unsupported

Unsupported

XML binary data collection mapping

Unsupported

Unsupported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure a Reference Descriptor Using Workbench

To specify a reference descriptor for an XML mapping that references another descriptor (instead of a schema element), use this procedure.

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Click the General tab. The General tab appears. General Tab, Reference Descriptor Field
    General Tab, Reference Descriptor Field

  3. If this XML attribute refers to another descriptor (instead of a schema element), use the Reference Descriptor field to select a descriptor in the project.


Configuring Maps to Wildcard

This attribute applies only to the Workbench. Use this option to solve "No XPath specified" problems (see How to Use the Problems Window) for an XML mapping that does not need an XPath (see Configuring XPath) for it maps to a wildcard.

If the XML mapping is owned by an anyType descriptor (see Configuring for Complex Type of anyType), it cannot map to a wildcard, and you must specify an XPath.

This table summarizes which XML mappings support maps to wildcard configuration.


XML Mapping Support for Maps to Wildcard Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Supported

Unsupported

XML any collection mapping

Supported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Unsupported

XML object collection mapping

Unsupported

Unsupported

XML binary data mapping

Unsupported

Unsupported

XML binary data collection mapping

Unsupported

Unsupported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure Maps to Wildcard Using Workbench

To specify a map a schema element using the xs:any declaration, use this procedure.

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Mapping Tab, Maps to Wildcard Option
    Mapping Tab, Maps to Wildcard Option

  3. If the XML mapping is not owned by an anyType descriptor (see Configuring for Complex Type of anyType) and maps to a wildcard, then you do not need to specify an XPath (see Configuring XPath). Select the Maps to Wildcard (uses "any" tag) option to clear the missing XPath neediness message.
  4. If the XML mapping is owned by an anyType descriptor, it cannot map to a wildcard and you must specify an XPath. Deselect the Maps to Wildcard (Uses "any" tag) option and ensure that you specify an XPath.


Configuring Source to Target Key Field Association

This option is applicable to key on source-based mappings. Use this option to add a source and target XPath pair to the map of such key pairs.

This table summarizes which XML mappings support source to target key field association configuration.


XML Mapping Support for Source to Target Key Field Association Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Supported

XML object collection mapping

Unsupported

Supported

XML binary data mapping

Unsupported

Unsupported

XML binary data collection mapping

Unsupported

Unsupported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure Source to Target Key Field Association Using Java

To configure the source to target key field association for your mapping, use the XMLObjectReferenceMapping method addSourceToTargetKeyFieldAssociation to add a specified source and target XPath pair to the map.

Configuring Reference Class

This option is applicable to key on source-based mappings.

Use this option to define the reference class, whose instances your XML object reference mapping will store in the domain objects.

This table summarizes which XML mappings support source to target key field association configuration.


XML Mapping Support for Reference Class Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Supported

XML object collection mapping

Unsupported

Supported

XML binary data mapping

Unsupported

Unsupported

XML binary data collection mapping

Unsupported

Unsupported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure Reference Class Using Java

To configure a reference class for your mapping, use the AggregateMapping method setReferenceClass.

Configuring the Use of Inline Binary Data

This option is applicable to binary data mappings.

Use this option to define whether or not there should always be inline binary data for this mapping.

This table summarizes which XML mappings support the use of inline binary data configuration.


XML Mapping Support for the Use of Inline Binary Data Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Unsupported

XML object collection mapping

Unsupported

Unsupported

XML binary data mapping

Unsupported

Supported

XML binary data collection mapping

Unsupported

Supported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure the Use of Inline Binary Data Using Java

To configure the use of inline binary data for your mapping, use the XMLBinaryDataMapping or XMLBinaryDataCollectionMapping method setShouldInlineBinaryData. If you set it to true, you disable consideration for attachment handling for this mapping and indicate that you only want inline data.

Configuring the Use of SwaRef Type

This option is applicable to binary data mappings.

Use this option to specify that the target node of this mapping is of type xs:swaref.

This table summarizes which XML mappings support the use of SwaRef type configuration.


XML Mapping Support for the Use of SwaRef Type Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Unsupported

XML object collection mapping

Unsupported

Unsupported

XML binary data mapping

Unsupported

Supported

XML binary data collection mapping

Unsupported

Supported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Unsupported

XML choice collection mapping

Unsupported

Unsupported

XML any attribute mapping

Unsupported

Unsupported


How to Configure the Use of SwaRef Type Using Java

To configure the use of SwaRef type for your mapping, use the XMLBinaryDataMapping or XMLBinaryDataCollectionMapping method setSwaRef. If you set it to true, you indicate that the target node of this mapping is of type xs:swaref.

Configuring the Choice Element

This option is applicable to choice mappings.

Use this option to specify an XPath and the type assocated with this XPath.

This table summarizes which XML mappings support the choice element configuration.


XML Mapping Support for the Choice Element Configuration

XML Mapping Using the Workbench Using Java

XML direct mapping

Unsupported

Unsupported

XML composite direct collection mapping

Unsupported

Unsupported

XML composite object mapping

Unsupported

Unsupported

XML composite collection mapping

Unsupported

Unsupported

XML any object mapping

Unsupported

Unsupported

XML any collection mapping

Unsupported

Unsupported

XML transformation mapping

Unsupported

Unsupported

XML object reference mapping

Unsupported

Unsupported

XML object collection mapping

Unsupported

Unsupported

XML binary data mapping

Unsupported

Unsupported

XML binary data collection mapping

Unsupported

Unsupported

XML fragment mapping

Unsupported

Unsupported

XML fragment collection mapping

Unsupported

Unsupported

XML choice object mapping

Unsupported

Supported

XML choice collection mapping

Unsupported

Supported

XML any attribute mapping

Unsupported

Unsupported


How to Configure the Choice Element Using Java

Use the following XMLChoiceObjectMapping or XMLChoiceCollectionMapping methods to add choice element:

  • addChoiceElement(String xpath, Class elementType)
  • addChoiceElement(String xpath, String elementTypeName)



Copyright Statement