Module org.eclipse.persistence.core
Class XPathEngine<XML_FIELD extends Field>
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.XPathEngine<XML_FIELD>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(List<Field> xmlFields, Node contextNode, List<XMLEntry> values, Field lastUpdatedField, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session)Nodecreate(Field xmlField, Node element, Object value, CoreAbstractSession session)Nodecreate(Field xmlField, Node element, Object value, Field lastUpdated, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session)Create the node path specified byxpathStringunderelementand initialize the leaf node withvalue.Nodecreate(Field xmlField, Node element, CoreAbstractSession session)Create the node path specified byxpathStringunderelement.ElementcreateUnownedElement(Node parent, Field xmlField)static XPathEnginegetInstance()Return theXPathEnginesingleton.NodeListremove(Field xmlField, Node element)Remove a node.NodeListremove(Field xmlField, Node element, boolean forceRemove)Remove a node.List<XMLEntry>replaceCollection(List<Field> xmlFields, List<XMLEntry> values, Node contextNode, DocumentPreservationPolicy docPresPolicy, Field lastUpdatedField, CoreAbstractSession session)NodeListreplaceCollection(Field xmlField, Node parent, Collection values, CoreAbstractSession session)NodeListreplaceValue(Field xmlField, Node parent, Object value, CoreAbstractSession session)Replace the value of the nodes matchingxpathStringwithvalue.
-
-
-
Method Detail
-
getInstance
public static XPathEngine getInstance()
Return theXPathEnginesingleton.
-
create
public Node create(Field xmlField, Node element, CoreAbstractSession session) throws XMLMarshalException
Create the node path specified byxpathStringunderelement. This method also supports creating attributes and indexed elements using the appropriate XPath syntax ('@' and '[ ]' respectively).- Parameters:
xmlField- XMLField containing xpath expression representing the node path to createelement- Root element under which to create path- Returns:
- The last
XMLNodein the path - Throws:
XMLMarshalException- Thrown if passed an invalid XPath string
-
create
public Node create(Field xmlField, Node element, Object value, CoreAbstractSession session)
-
create
public Node create(Field xmlField, Node element, Object value, Field lastUpdated, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session) throws XMLMarshalException
Create the node path specified byxpathStringunderelementand initialize the leaf node withvalue. This method also supports creating attributes and integer-indexed elements using the appropriate XPath syntax ('@' and '[ ]' respectively).- Parameters:
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)- Returns:
- The last
XMLNodein the path - Throws:
XMLMarshalException- Thrown if passed an invalid XPath string
-
create
public void create(List<Field> xmlFields, Node contextNode, List<XMLEntry> values, Field lastUpdatedField, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session)
-
remove
public NodeList remove(Field xmlField, Node element) throws XMLMarshalException
Remove a node. IfxpathStringpoints to an indexed element, the element will not be removed, but will instead be reinitialzed (to maintain the index of the collection).- Parameters:
xmlField- Field containing XPath query stringelement- Root element at which to begin search- Returns:
NodeListcontaining the nodes that were removed.- Throws:
XMLMarshalException- Thrown if passed an invalid XPath string
-
remove
public NodeList remove(Field xmlField, Node element, boolean forceRemove) throws XMLMarshalException
Remove a node.- Parameters:
xmlField- Field containing XPath query stringelement- Root element at which to begin searchforceRemove- Iftrue, then indexed elements will be truly deleted, otherwise they will be reinitialized- Returns:
NodeListcontaining the nodes that were removed.- Throws:
XMLMarshalException- Thrown if passed an invalid XPath string
-
replaceValue
public NodeList replaceValue(Field xmlField, Node parent, Object value, CoreAbstractSession session) throws XMLMarshalException
Replace the value of the nodes matchingxpathStringwithvalue. This method handles elements, indexed elements, and attributes.- Parameters:
xmlField- Field containing XPath query stringparent- Parent elementvalue- New value for the node- Returns:
NodeListcontaining the nodes that were replaced.- Throws:
XMLMarshalException
-
replaceCollection
public List<XMLEntry> replaceCollection(List<Field> xmlFields, List<XMLEntry> values, Node contextNode, DocumentPreservationPolicy docPresPolicy, Field lastUpdatedField, CoreAbstractSession session)
-
replaceCollection
public NodeList replaceCollection(Field xmlField, Node parent, Collection values, CoreAbstractSession session) throws XMLMarshalException
- Throws:
XMLMarshalException
-
-