public class CachedXPathAPI extends Object
Modifier and Type | Field and Description |
---|---|
protected XPathContext |
xpathSupport
XPathContext, and thus the document model system (DTMs), persists through multiple
calls to this object.
|
Constructor and Description |
---|
CachedXPathAPI()
Default constructor.
|
CachedXPathAPI(CachedXPathAPI priorXPathAPI)
This constructor shares its
XPathContext with a pre-existing
CachedXPathAPI . |
Modifier and Type | Method and Description |
---|---|
XObject |
eval(Node contextNode,
String str)
Evaluate XPath string to an XObject.
|
XObject |
eval(Node contextNode,
String str,
Node namespaceNode)
Evaluate XPath string to an XObject.
|
XObject |
eval(Node contextNode,
String str,
PrefixResolver prefixResolver)
Evaluate XPath string to an XObject.
|
XPathContext |
getXPathContext()
Returns the XPathSupport object used in this CachedXPathAPI
%REVIEW% I'm somewhat concerned about the loss of encapsulation
this causes, but the xml-security folks say they need it.
|
org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(Node contextNode,
String str)
Use an XPath string to select a nodelist.
|
org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(Node contextNode,
String str,
Node namespaceNode)
Use an XPath string to select a nodelist.
|
NodeList |
selectNodeList(Node contextNode,
String str)
Use an XPath string to select a nodelist.
|
NodeList |
selectNodeList(Node contextNode,
String str,
Node namespaceNode)
Use an XPath string to select a nodelist.
|
Node |
selectSingleNode(Node contextNode,
String str)
Use an XPath string to select a single node.
|
Node |
selectSingleNode(Node contextNode,
String str,
Node namespaceNode)
Use an XPath string to select a single node.
|
protected XPathContext xpathSupport
public CachedXPathAPI()
Default constructor. Establishes its own XPathContext
, and hence
its own DTMManager
.
Good choice for simple uses.
Note that any particular instance of CachedXPathAPI
must not be
operated upon by multiple threads without synchronization; we do
not currently support multithreaded access to a single
DTM
.
public CachedXPathAPI(CachedXPathAPI priorXPathAPI)
This constructor shares its XPathContext
with a pre-existing
CachedXPathAPI
. That allows sharing document models
(DTM
) and previously established location
state.
Note that the original CachedXPathAPI
and the new one should
not be operated upon concurrently; we do not support multithreaded access
to a single DTM
at this time. Similarly,
any particular instance of CachedXPathAPI
must not be operated
upon by multiple threads without synchronization.
%REVIEW% Should this instead do a clone-and-reset on the XPathSupport object?
public XPathContext getXPathContext()
public Node selectSingleNode(Node contextNode, String str) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.TransformerException
public Node selectSingleNode(Node contextNode, String str, Node namespaceNode) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.namespaceNode
- The node from which prefixes in the XPath will be resolved to namespaces.TransformerException
public org.w3c.dom.traversal.NodeIterator selectNodeIterator(Node contextNode, String str) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.TransformerException
public org.w3c.dom.traversal.NodeIterator selectNodeIterator(Node contextNode, String str, Node namespaceNode) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.namespaceNode
- The node from which prefixes in the XPath will be resolved to namespaces.TransformerException
public NodeList selectNodeList(Node contextNode, String str) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.TransformerException
public NodeList selectNodeList(Node contextNode, String str, Node namespaceNode) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.namespaceNode
- The node from which prefixes in the XPath will be resolved to namespaces.TransformerException
public XObject eval(Node contextNode, String str) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.TransformerException
XObject
,
XNull
,
XBoolean
,
XNumber
,
XString
,
XRTreeFrag
public XObject eval(Node contextNode, String str, Node namespaceNode) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.namespaceNode
- The node from which prefixes in the XPath will be resolved to namespaces.TransformerException
XObject
,
XNull
,
XBoolean
,
XNumber
,
XString
,
XRTreeFrag
public XObject eval(Node contextNode, String str, PrefixResolver prefixResolver) throws TransformerException
contextNode
- The node to start searching from.str
- A valid XPath string.prefixResolver
- Will be called if the parser encounters namespace
prefixes, to resolve the prefixes to URLs.TransformerException
XObject
,
XNull
,
XBoolean
,
XNumber
,
XString
,
XRTreeFrag
Copyright © 2019 JBoss by Red Hat. All rights reserved.