public class CachedXPathAPI
extends java.lang.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,
java.lang.String str)
Evaluate XPath string to an XObject.
|
XObject |
eval(Node contextNode,
java.lang.String str,
Node namespaceNode)
Evaluate XPath string to an XObject.
|
XObject |
eval(Node contextNode,
java.lang.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.
|
NodeIterator |
selectNodeIterator(Node contextNode,
java.lang.String str)
Use an XPath string to select a nodelist.
|
NodeIterator |
selectNodeIterator(Node contextNode,
java.lang.String str,
Node namespaceNode)
Use an XPath string to select a nodelist.
|
NodeList |
selectNodeList(Node contextNode,
java.lang.String str)
Use an XPath string to select a nodelist.
|
NodeList |
selectNodeList(Node contextNode,
java.lang.String str,
Node namespaceNode)
Use an XPath string to select a nodelist.
|
Node |
selectSingleNode(Node contextNode,
java.lang.String str)
Use an XPath string to select a single node.
|
Node |
selectSingleNode(Node contextNode,
java.lang.String str,
Node namespaceNode)
Use an XPath string to select a single node.
|
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, java.lang.String str) throws TransformerException
contextNode - The node to start searching from.str - A valid XPath string.TransformerExceptionpublic Node selectSingleNode(Node contextNode, java.lang.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.TransformerExceptionpublic NodeIterator selectNodeIterator(Node contextNode, java.lang.String str) throws TransformerException
contextNode - The node to start searching from.str - A valid XPath string.TransformerExceptionpublic NodeIterator selectNodeIterator(Node contextNode, java.lang.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.TransformerExceptionpublic NodeList selectNodeList(Node contextNode, java.lang.String str) throws TransformerException
contextNode - The node to start searching from.str - A valid XPath string.TransformerExceptionpublic NodeList selectNodeList(Node contextNode, java.lang.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.TransformerExceptionpublic XObject eval(Node contextNode, java.lang.String str) throws TransformerException
contextNode - The node to start searching from.str - A valid XPath string.TransformerExceptionXObject,
XNull,
XBoolean,
XNumber,
XString,
XRTreeFragpublic XObject eval(Node contextNode, java.lang.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.TransformerExceptionXObject,
XNull,
XBoolean,
XNumber,
XString,
XRTreeFragpublic XObject eval(Node contextNode, java.lang.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.TransformerExceptionXObject,
XNull,
XBoolean,
XNumber,
XString,
XRTreeFragCopyright © 2014 Apache XML Project. All Rights Reserved.