Module org.eclipse.persistence.core
Class XPathEngine<XML_FIELD extends Field>
java.lang.Object
org.eclipse.persistence.internal.oxm.XPathEngine<XML_FIELD>
INTERNAL:
Purpose: Utility class for creating and removing XML nodes using XPath expressions.
- Since:
- OracleAS TopLink 10g (10.0.3), 03/11/2003 10:21:42
-
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(List<Field> xmlFields, Node contextNode, List<XMLEntry> values, Field lastUpdatedField, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session) create
(Field xmlField, Node element, Object value, CoreAbstractSession session) create
(Field xmlField, Node element, Object value, Field lastUpdated, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session) Create the node path specified byxpathString
underelement
and initialize the leaf node withvalue
.create
(Field xmlField, Node element, CoreAbstractSession session) Create the node path specified byxpathString
underelement
.createUnownedElement
(Node parent, Field xmlField) static XPathEngine
Return theXPathEngine
singleton.Remove a node.Remove a node.replaceCollection
(List<Field> xmlFields, List<XMLEntry> values, Node contextNode, DocumentPreservationPolicy docPresPolicy, Field lastUpdatedField, CoreAbstractSession session) replaceCollection
(Field xmlField, Node parent, Collection values, CoreAbstractSession session) replaceValue
(Field xmlField, Node parent, Object value, CoreAbstractSession session) Replace the value of the nodes matchingxpathString
withvalue
.
-
Method Details
-
getInstance
Return theXPathEngine
singleton. -
create
public Node create(Field xmlField, Node element, CoreAbstractSession session) throws XMLMarshalException Create the node path specified byxpathString
underelement
. 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
XMLNode
in the path - Throws:
XMLMarshalException
- Thrown if passed an invalid XPath string
-
create
-
create
public Node create(Field xmlField, Node element, Object value, Field lastUpdated, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session) throws XMLMarshalException Create the node path specified byxpathString
underelement
and 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
XMLNode
in 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) -
createUnownedElement
-
remove
Remove a node. IfxpathString
points 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:
NodeList
containing 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:
NodeList
containing 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 matchingxpathString
withvalue
. This method handles elements, indexed elements, and attributes.- Parameters:
xmlField
- Field containing XPath query stringparent
- Parent elementvalue
- New value for the node- Returns:
NodeList
containing 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
-