Class XPathEngine<XML_FIELD extends Field>
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.XPathEngine<XML_FIELD>
-
public class XPathEngine<XML_FIELD extends Field> extends Object
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
- Author:
- Rick Barkhouse - [email protected]
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create(List<Field> xmlFields, Node contextNode, List<XMLEntry> values, Field lastUpdatedField, DocumentPreservationPolicy docPresPolicy, CoreAbstractSession session)
Node
create(Field xmlField, Node element, Object value, CoreAbstractSession session)
Node
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
.Node
create(Field xmlField, Node element, CoreAbstractSession session)
Create the node path specified byxpathString
underelement
.Element
createUnownedElement(Node parent, Field xmlField)
static XPathEngine
getInstance()
Return theXPathEngine
singleton.NodeList
remove(Field xmlField, Node element)
Remove a node.NodeList
remove(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)
NodeList
replaceCollection(Field xmlField, Node parent, Collection values, CoreAbstractSession session)
NodeList
replaceValue(Field xmlField, Node parent, Object value, CoreAbstractSession session)
Replace the value of the nodes matchingxpathString
withvalue
.
-
-
-
Method Detail
-
getInstance
public static XPathEngine 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
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 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)
-
remove
public NodeList remove(Field xmlField, Node element) throws XMLMarshalException
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
-
-