TopLink XML mappings make use of XMLFields based on 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
field using the setXPath method or by using the appropriate constructor.

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

XPath

Description

@name

The "@" character indicates that the node is an attribute.

text()

"text()" indicates that the node is a text node. In this case the name value in the
text node belongs to the context node.

full-name/text()

The name information is stored in the text node of the full-name element.

personal-info/name/text()

The XPath statement may be used to specify any valid path.

name[2]/text()

The XPath statement may contain positional information. In this case the name
information is stored in the text node of the second occurrence of the name element.

Mapping to a Specific Schema Type: In most cases TopLink can determine the target format in the
XML document. However, there are cases where you must specify which one of a number of possible targets
TopLink should use. For example, a java.util.Calendar could be marshalled to a schema date, time, or dateTime,
or a byte[] could be marshalled to a schema hexBinary or base64Binary node.

Setting custom conversion pairs: By default in TopLink XML built-in schema types are associated with
java classes and vice versa. These default pairs can be modified by the user using the addJavaConversion and
addXMLConversion api. For example by default a java.util.Calendar is mapped to the dateTime schema type
so the XML will be formated based on that type. Below are the default schema type to java type conversion pairs
and the default java type to schema type conversion pairs.