54 Configuring an XML Mapping

This chapter describes how to configure an XML mapping.

This chapter includes the following sections:

For information on how to configure TopLink mappings options common to two or more mapping types, see Chapter 121, "Configuring a Mapping".

For information on how to create TopLink mappings, see Chapter 120, "Creating a Mapping".

54.1 Introduction to XML Mapping Configuration

Table 54-1 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.

Table 54-1 Configuring XML Mappings

Mapping Type See Also...

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Chapter 55, "Configuring an XML Direct Mapping"

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Chapter 56, "Configuring an XML Composite Direct Collection Mapping"

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Chapter 57, "Configuring an XML Composite Object Mapping"

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Chapter 58, "Configuring an XML Composite Collection Mapping"

XML any object mapping (see Section 53.7, "XML Any Object Mapping")

Chapter 59, "Configuring an XML Any Object Mapping"

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Chapter 60, "Configuring an XML Any Collection Mapping"

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Chapter 61, "Configuring an XML Transformation Mapping"

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML collection reference mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML binary data mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML binary data collection mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML fragment mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML fragment collection mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML choice object mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML choice collection mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"

XML any attribute mapping (see Section 53.10, "XML Object Reference Mapping")

Chapter 62, "Configuring an XML Object Reference Mapping"


For more information, see the following:

54.3 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, TopLink uses the xsi:Type attribute to determine the reference class object.

In TopLink versions prior to 11g (11.1.1.0), the reference class was required.

Table 54-3 summarizes which XML mappings support reference descriptor configuration.

Table 54-3 XML Mapping Support for Reference Descriptor Configuration

XML Mapping How to Use Oracle JDeveloper How to Configure a Reference Descriptor Using TopLink Workbench
How to Use Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Unsupported

Unsupported

Unsupported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Unsupported

Unsupported

Unsupported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Unsupported

Unsupported

Unsupported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Unsupported

Unsupported

Unsupported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Unsupported

Unsupported

Unsupported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Unsupported

Unsupported

Unsupported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Unsupported

Unsupported

Unsupported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Unsupported

Unsupported

Unsupported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Unsupported

Unsupported

Unsupported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.3.1 How to Configure a Reference Descriptor Using TopLink 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.

    Figure 54-1 General Tab, Reference Descriptor Field

    Description of Figure 54-1 follows
    Description of "Figure 54-1 General Tab, Reference Descriptor Field"

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.

54.4 Configuring Maps to Wildcard

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

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

Table 54-4 summarizes which XML mappings support maps to wildcard configuration.

Table 54-4 XML Mapping Support for Maps to Wildcard Configuration

XML Mapping How to Use Oracle JDeveloper How to Configure Maps to Wildcard Using TopLink Workbench How to Use Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Unsupported

Unsupported

Unsupported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Unsupported

Unsupported

Unsupported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Unsupported

Unsupported

Unsupported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Unsupported

Unsupported

Unsupported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.4.1 How to Configure Maps to Wildcard Using TopLink 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. Figure 54-2 Mapping Tab, Maps to Wildcard Option

    Description of Figure 54-2 follows
    Description of "Figure 54-2 Mapping Tab, Maps to Wildcard Option"

If the XML mapping is not owned by an anyType descriptor (see Section 52.3, "Configuring for Complex Type of anyType") and maps to a wildcard, then you do not need to specify an XPath (see Section 121.4, "Configuring XPath"). Select the Maps to Wildcard (uses "any" tag) option to clear the missing XPath neediness message.

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.

54.5 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.

Table 54-5 summarizes which XML mappings support source to target key field association configuration.

Table 54-5 XML Mapping Support for Source to Target Key Field Association Configuration

XML Mapping How to Use Oracle JDeveloper How to Use TopLink Workbench How to Configure Source to Target Key Field Association Using Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Supported

Unsupported

Supported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Supported

Unsupported

Supported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Unsupported

Unsupported

Unsupported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Unsupported

Unsupported

Unsupported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.5.1 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.

54.6 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.

Table 54-6 summarizes which XML mappings support source to target key field association configuration.

Table 54-6 XML Mapping Support for Reference Class Configuration

XML Mapping How to Use Oracle JDeveloper How to Use TopLink Workbench How to Configure Reference Class Using Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Supported

Unsupported

Supported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Supported

Unsupported

Supported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Unsupported

Unsupported

Unsupported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Unsupported

Unsupported

Unsupported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.6.1 How to Configure Reference Class Using Java

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

54.7 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.

Table 54-7 summarizes which XML mappings support the use of inline binary data configuration.

Table 54-7 XML Mapping Support for the Use of Inline Binary Data Configuration

XML Mapping How to Use Oracle JDeveloper How to Use TopLink Workbench How to Configure the Use of Inline Binary Data Using Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Unsupported

Unsupported

Unsupported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Unsupported

Unsupported

Unsupported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Supported

Unsupported

Supported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Supported

Unsupported

Supported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.7.1 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.

54.8 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.

Table 54-8 summarizes which XML mappings support the use of SwaRef type configuration.

Table 54-8 XML Mapping Support for the Use of SwaRef Type Configuration

XML Mapping How to Use Oracle JDeveloper How to Use TopLink Workbench How to Configure the Use of SwaRef Type Using Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Unsupported

Unsupported

Unsupported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Unsupported

Unsupported

Unsupported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Supported

Unsupported

Supported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Supported

Unsupported

Supported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Unsupported

Unsupported

Unsupported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Unsupported

Unsupported

Unsupported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.8.1 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.

54.9 Configuring the Choice Element

This option is applicable to choice mappings.

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

Table 54-9 summarizes which XML mappings support the choice element configuration.

Table 54-9 XML Mapping Support for the Choice Element Configuration

XML Mapping How to Use Oracle JDeveloper How to Use TopLink Workbench How to Configure the Choice Element Using Java

XML direct mapping (see Section 53.3, "XML Direct Mapping")

Supported Supported Supported

XML composite direct collection mapping (see Section 53.4, "XML Composite Direct Collection Mapping")

Supported Supported Supported

XML composite object mapping (see Section 53.5, "XML Composite Object Mapping")

Supported Supported Supported

XML composite collection mapping (see Section 53.6, "XML Composite Collection Mapping")

Supported Supported Supported

XML any object mapping (seeSection 53.7, "XML Any Object Mapping")

Supported Supported Supported

XML any collection mapping (see Section 53.8, "XML Any Collection Mapping")

Supported Supported Supported

XML transformation mapping (see Section 53.9, "XML Transformation Mapping")

Supported Supported Supported

XML object reference mapping (see Section 53.10, "XML Object Reference Mapping")

Unsupported

Unsupported

Unsupported

XML object collection mapping (see Section 53.11, "XML Collection Reference Mapping")

Unsupported

Unsupported

Unsupported

XML binary data mapping (see Section 53.12, "XML Binary Data Mapping")

Unsupported

Unsupported

Unsupported

XML binary data collection mapping (see Section 53.13, "XML Binary Data Collection Mapping")

Unsupported

Unsupported

Unsupported

XML fragment mapping (see Section 53.14, "XML Fragment Mapping")

Unsupported

Unsupported

Unsupported

XML fragment collection mapping (see Section 53.15, "XML Fragment Collection Mapping")

Unsupported

Unsupported

Unsupported

XML choice object mapping (see Section 53.16, "XML Choice Object Mapping")

Supported

Unsupported

Supported

XML choice collection mapping (see Section 53.17, "XML Choice Collection Mapping")

Supported

Unsupported

Supported

XML any attribute mapping (see Section 53.18, "XML Any Attribute Mapping")

Unsupported

Unsupported

Unsupported


54.9.1 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)