Class XMLFragmentMapping

All Implemented Interfaces:
Serializable, Cloneable, DirectMapping<AbstractSession,AttributeAccessor,ContainerPolicy,Converter,ClassDescriptor,DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>, FragmentMapping<AbstractSession,AttributeAccessor,ContainerPolicy,ClassDescriptor,DatabaseField,Session,XMLRecord>, Mapping<AbstractSession,AttributeAccessor,ContainerPolicy,ClassDescriptor,DatabaseField,XMLRecord>, XMLConverterMapping<XMLMarshaller,Session,XMLUnmarshaller>, MapComponentMapping, MapKeyMapping, XMLMapping, XMLNillableMapping

Purpose: This mapping provides a means to keep a part of the xml tree as a DOM element.

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 path and positional information; the last node in the XPath forms the local root node for the fragment. The XPath is specified on the mapping using the setXPath method.

XPath statements
XPath Description
phone-number The phone-number information is stored in the phone-number element.
contact-info/phone-number The XPath statement may be used to specify any valid path.

Sample Configuration:


 XMLFragmentCollectionMapping mapping = new XMLFragmentCollectionMapping();
 mapping.setAttributeName("phoneNumber");
 mapping.setXPath("contact-info/phone-number");
 
 
See Also: