Oracle Fusion Middleware Java API Reference for Oracle TopLink (Deprecated)
11g Release 1 (11.1.1)


Class XMLAnyObjectMapping

  extended by oracle.toplink.mappings.DatabaseMapping
      extended by oracle.toplink.ox.mappings.XMLAnyObjectMapping
All Implemented Interfaces:, java.lang.Cloneable, oracle.toplink.ox.mappings.XMLMapping

public class XMLAnyObjectMapping
extends DatabaseMapping
implements oracle.toplink.ox.mappings.XMLMapping

Any object XML mappings map an attribute that contains a single object to an XML element. The referenced object may be of any type (including String), and does not need not be related to any other particular type through inheritance or a common interface. The corresponding object attribute value should be generic enough for all possible application values. Note that each of the referenced objects (except String) must specify a default root element on their descriptor.

Any object XML mappings are useful with the following XML schema constructs:

Setting the XPath: TopLink XML mappings make use of XPath statements to find the relevant data in an XML document. The XPath statement is relative to the context node specified in the descriptor. The XPath may contain node type, path, and positional information. The XPath is specified on the mapping using the setXPath method. Note that for XML Any Object Mappings the XPath is optional.

The following XPath statements may be used to specify the location of XML data relating to an object's name attribute:

XPath Description
contact-method The name information is stored in the contact-method element.
contact-method/info The XPath statement may be used to specify any valid path.
contact-method[2] The XPath statement may contain positional information. In this case the contact information is stored in the second occurrence of the contact-method element.

Mapping an element of type xs:anyType as an Any Object Mapping:

XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="">
  <xsd:element name="customer" type="customer-type"/>
  <xsd:complexType name="customer-type">
      <xsd:element name="contact-method" type="xsd:anyType"/>
  <xsd:element name="address">
        <xsd:element name="street" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
  <xsd:element name="phone-number" type="xsd:string"/>

Code Sample
XMLAnyObjectMapping contactMethodMapping = new XMLAnyObjectMapping();

More Information: For more information about using the XML Any Object Mapping, see the "Understanding XML Mappings" chapter of the Oracle TopLink Developer's Guide.

Oracle TopLink 10g Release 2 (10.1.3)
See Also:
Serialized Form

Constructor Summary
Method Summary
 org.w3c.dom.Node getNodeToReplace(org.w3c.dom.Node parent)
 void setField(DatabaseField field)
 void setUseXMLRoot(boolean useXMLRoot)
 void setXPath(java.lang.String xpath)
 boolean usesXMLRoot()
Methods inherited from class oracle.toplink.mappings.DatabaseMapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getProperty, getReferenceDescriptor, getSetMethodName, isLazy, isOptional, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsLazy, setIsOptional, setIsReadOnly, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public XMLAnyObjectMapping()
Method Detail


public void setXPath(java.lang.String xpath)


public void setField(DatabaseField field)


public void setUseXMLRoot(boolean useXMLRoot)


public boolean usesXMLRoot()


public org.w3c.dom.Node getNodeToReplace(org.w3c.dom.Node parent)

Copyright © 1998, 2012, Oracle. All Rights Reserved.