public class XPathEngine<XML_FIELD extends Field>
extends java.lang.Object
Purpose: Utility class for creating and removing XML nodes using XPath expressions.
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Node |
create(Field xmlField,
org.w3c.dom.Node element,
CoreAbstractSession session)
Create the node path specified by
xpathString under element . |
org.w3c.dom.Node |
create(Field xmlField,
org.w3c.dom.Node element,
java.lang.Object value,
CoreAbstractSession session) |
org.w3c.dom.Node |
create(Field xmlField,
org.w3c.dom.Node element,
java.lang.Object value,
Field lastUpdated,
DocumentPreservationPolicy docPresPolicy,
CoreAbstractSession session)
Create the node path specified by
xpathString under element
and initialize the leaf node with value . |
void |
create(java.util.List<Field> xmlFields,
org.w3c.dom.Node contextNode,
java.util.List<XMLEntry> values,
Field lastUpdatedField,
DocumentPreservationPolicy docPresPolicy,
CoreAbstractSession session) |
org.w3c.dom.Element |
createUnownedElement(org.w3c.dom.Node parent,
Field xmlField) |
static XPathEngine |
getInstance()
Return the
XPathEngine singleton. |
org.w3c.dom.NodeList |
remove(Field xmlField,
org.w3c.dom.Node element)
Remove a node.
|
org.w3c.dom.NodeList |
remove(Field xmlField,
org.w3c.dom.Node element,
boolean forceRemove)
Remove a node.
|
org.w3c.dom.NodeList |
replaceCollection(Field xmlField,
org.w3c.dom.Node parent,
java.util.Collection values,
CoreAbstractSession session) |
java.util.List<XMLEntry> |
replaceCollection(java.util.List<Field> xmlFields,
java.util.List<XMLEntry> values,
org.w3c.dom.Node contextNode,
DocumentPreservationPolicy docPresPolicy,
Field lastUpdatedField,
CoreAbstractSession session) |
org.w3c.dom.NodeList |
replaceValue(Field xmlField,
org.w3c.dom.Node parent,
java.lang.Object value,
CoreAbstractSession session)
Replace the value of the nodes matching
xpathString with value . |
public static XPathEngine getInstance()
XPathEngine
singleton.public org.w3c.dom.Node create(Field xmlField, org.w3c.dom.Node element, CoreAbstractSession 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(Field xmlField, org.w3c.dom.Node element, java.lang.Object value, CoreAbstractSession session)
public org.w3c.dom.Node create(Field xmlField, org.w3c.dom.Node element, java.lang.Object value, Field lastUpdated, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession 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<Field> xmlFields, org.w3c.dom.Node contextNode, java.util.List<XMLEntry> values, Field lastUpdatedField, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session)
public org.w3c.dom.Element createUnownedElement(org.w3c.dom.Node parent, Field xmlField)
public org.w3c.dom.NodeList remove(Field 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(Field 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(Field xmlField, org.w3c.dom.Node parent, java.lang.Object value, CoreAbstractSession 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<Field> xmlFields, java.util.List<XMLEntry> values, org.w3c.dom.Node contextNode, DocumentPreservationPolicy docPresPolicy, Field lastUpdatedField, CoreAbstractSession session)
public org.w3c.dom.NodeList replaceCollection(Field xmlField, org.w3c.dom.Node parent, java.util.Collection values, CoreAbstractSession session) throws XMLMarshalException
XMLMarshalException
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference