public class XPathEngine
extends java.lang.Object
Purpose: Utility class for creating and removing XML nodes using XPath expressions.
Modifier and Type | Method and Description |
---|---|
void |
create(java.util.List<XMLField> xmlFields,
org.w3c.dom.Node contextNode,
java.util.List<XMLEntry> values,
XMLField lastUpdatedField,
DocumentPreservationPolicy docPresPolicy,
AbstractSession session) |
org.w3c.dom.Node |
create(XMLField xmlField,
org.w3c.dom.Node element,
AbstractSession session)
Create the node path specified by
xpathString under element . |
org.w3c.dom.Node |
create(XMLField xmlField,
org.w3c.dom.Node element,
java.lang.Object value,
AbstractSession session) |
org.w3c.dom.Node |
create(XMLField xmlField,
org.w3c.dom.Node element,
java.lang.Object value,
XMLField lastUpdated,
DocumentPreservationPolicy docPresPolicy,
AbstractSession session)
Create the node path specified by
xpathString under element
and initialize the leaf node with value . |
org.w3c.dom.Element |
createUnownedElement(org.w3c.dom.Node parent,
XMLField xmlField) |
static XPathEngine |
getInstance()
Return the
XPathEngine singleton. |
org.w3c.dom.NodeList |
remove(XMLField xmlField,
org.w3c.dom.Node element)
Remove a node.
|
org.w3c.dom.NodeList |
remove(XMLField xmlField,
org.w3c.dom.Node element,
boolean forceRemove)
Remove a node.
|
java.util.List<XMLEntry> |
replaceCollection(java.util.List<XMLField> xmlFields,
java.util.List<XMLEntry> values,
org.w3c.dom.Node contextNode,
DocumentPreservationPolicy docPresPolicy,
XMLField lastUpdatedField,
AbstractSession session) |
org.w3c.dom.NodeList |
replaceCollection(XMLField xmlField,
org.w3c.dom.Node parent,
java.util.Collection values,
AbstractSession session) |
org.w3c.dom.NodeList |
replaceValue(XMLField xmlField,
org.w3c.dom.Node parent,
java.lang.Object value,
AbstractSession session)
Replace the value of the nodes matching
xpathString with value . |
public static XPathEngine getInstance()
XPathEngine
singleton.public org.w3c.dom.Node create(XMLField xmlField, org.w3c.dom.Node element, AbstractSession session) throws XMLMarshalException
xpathString
under element
.
This method also supports creating attributes and indexed elements using the appropriate
XPath syntax ('@
' and '[ ]
' respectively).xmlField
- XMLField containing xpath expression representing the node path to createelement
- Root element under which to create pathXMLNode
in the pathorg.eclipse.persistence.oxm.exceptions.XMLMarshalException
- Thrown if passed an invalid XPath stringXMLMarshalException
public org.w3c.dom.Node create(XMLField xmlField, org.w3c.dom.Node element, java.lang.Object value, AbstractSession session)
public org.w3c.dom.Node create(XMLField xmlField, org.w3c.dom.Node element, java.lang.Object value, XMLField lastUpdated, DocumentPreservationPolicy docPresPolicy, AbstractSession session) throws XMLMarshalException
xpathString
under element
and initialize the leaf node with value
.
This method also supports creating attributes and integer-indexed elements using the
appropriate XPath syntax ('@
' and '[ ]
' respectively).xmlField
- XMLField containing xpath expression representing the node path to createelement
- Root element under which to create pathvalue
- Initial value for the leaf node (should not be a list)XMLNode
in the pathorg.eclipse.persistence.oxm.exceptions.XMLMarshalException
- Thrown if passed an invalid XPath stringXMLMarshalException
public void create(java.util.List<XMLField> xmlFields, org.w3c.dom.Node contextNode, java.util.List<XMLEntry> values, XMLField lastUpdatedField, DocumentPreservationPolicy docPresPolicy, AbstractSession session)
public org.w3c.dom.Element createUnownedElement(org.w3c.dom.Node parent, XMLField xmlField)
public org.w3c.dom.NodeList remove(XMLField xmlField, org.w3c.dom.Node element) throws XMLMarshalException
xpathString
points to an indexed element, the element will not be removed,
but will instead be reinitialzed (to maintain the index of the collection).xmlField
- Field containing XPath query stringelement
- Root element at which to begin searchNodeList
containing the nodes that were removed.org.eclipse.persistence.oxm.exceptions.XMLMarshalException
- Thrown if passed an invalid XPath stringXMLMarshalException
public org.w3c.dom.NodeList remove(XMLField xmlField, org.w3c.dom.Node element, boolean forceRemove) throws XMLMarshalException
xmlField
- Field containing XPath query stringelement
- Root element at which to begin searchforceRemove
- If true
, then indexed elements will be truly deleted, otherwise they will be reinitializedNodeList
containing the nodes that were removed.org.eclipse.persistence.oxm.exceptions.XMLMarshalException
- Thrown if passed an invalid XPath stringXMLMarshalException
public org.w3c.dom.NodeList replaceValue(XMLField xmlField, org.w3c.dom.Node parent, java.lang.Object value, AbstractSession session) throws XMLMarshalException
xpathString
with value
.
This method handles elements, indexed elements, and attributes.xmlField
- Field containing XPath query stringparent
- Parent elementvalue
- New value for the nodeNodeList
containing the nodes that were replaced.XMLMarshalException
public java.util.List<XMLEntry> replaceCollection(java.util.List<XMLField> xmlFields, java.util.List<XMLEntry> values, org.w3c.dom.Node contextNode, DocumentPreservationPolicy docPresPolicy, XMLField lastUpdatedField, AbstractSession session)
public org.w3c.dom.NodeList replaceCollection(XMLField xmlField, org.w3c.dom.Node parent, java.util.Collection values, AbstractSession session) throws XMLMarshalException
XMLMarshalException
EclipseLink 2.4.2, "build v20130514-5956486" API Reference