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 | 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");
| Access | Constructor and Description |
|---|---|
| public |
| XMLFragmentMapping | back to summary |
|---|---|
| public XMLFragmentMapping() | |
| isAbstractColumnMapping | back to summary |
|---|---|
| public boolean isAbstractColumnMapping() Overrides org. Doc from org. INTERNAL:
| |
| isAbstractDirectMapping | back to summary |
|---|---|
| public boolean isAbstractDirectMapping() Overrides org. Implements org. Doc from org. Related mapping should implement this method to return true.
| |
| setXPath | back to summary |
|---|---|
| public void setXPath(String xpathString) Overrides org. Implements org. Doc from org. Set the Mapping field name attribute to the given XPath String | |
| valueFromRow | back to summary |
|---|---|
| public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) Overrides org. Doc from org. INTERNAL: Return the mapping's attribute value from the row. The execution session is passed for the case of building a UnitOfWork clone directly from a row, the session set in the query will not know which platform to use for converting the value. Allows the correct session to be passed in.
| |
| writeFromObjectIntoRow | back to summary |
|---|---|
| public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping. Overrides org. INTERNAL: Get a value from the object and set that in the respective field of the row.
| |
| writeSingleValue | back to summary |
|---|---|
| public void writeSingleValue(Object attributeValue, Object parent, XMLRecord row, AbstractSession session) Overrides org. Implements org. Doc from org. INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling. | |