public class XPathEvaluator
extends java.lang.Object
Constructor and Description |
---|
XPathEvaluator()
Default constructor.
|
XPathEvaluator(Configuration config)
Construct an XPathEvaluator with a specified configuration.
|
Modifier and Type | Method and Description |
---|---|
NodeInfo |
build(javax.xml.transform.Source source)
Build a source document.
|
XPathExpression |
createExpression(java.lang.String expression)
Prepare an XPath expression for subsequent evaluation.
|
Configuration |
getConfiguration()
Get the Configuration in use
|
NamespaceResolver |
getNamespaceResolver()
Get the external namespace resolver, if one has been set using
setNamespaceResolver(net.sf.saxon.om.NamespaceResolver) |
IndependentContext |
getStaticContext()
Get the current static context.
|
static void |
main(java.lang.String[] args)
A simple command-line interface for the XPathEvaluator (not documented).
|
void |
setDefaultElementNamespace(java.lang.String uri)
Set the default namespace for elements and types
|
void |
setNamespaceResolver(NamespaceResolver namespaceContext)
Set the external namespace resolver to be used.
|
void |
setStaticContext(IndependentContext context)
Set the static context for compiling XPath expressions.
|
void |
setStripSpace(boolean strip)
Indicate whether all whitespace text nodes in the source document are to be
removed.
|
public XPathEvaluator()
public XPathEvaluator(Configuration config)
config
- the configuration to be usedpublic Configuration getConfiguration()
public void setStripSpace(boolean strip)
strip
- True if all whitespace text nodes are to be stripped from the source document,
false otherwise. The default if the method is not called is false.public NodeInfo build(javax.xml.transform.Source source) throws XPathException
source
- a JAXP Source object. This may be any implementation of Source that Saxon recognizes:
not only the standard kinds of source such as StreamSource, SAXSource, and DOMSource, but also for
example a JDOM or XOM DocumentWrapper.XPathException
- if, for example, XML parsing fails.public void setStaticContext(IndependentContext context)
public IndependentContext getStaticContext()
public XPathExpression createExpression(java.lang.String expression) throws XPathException
expression
- The XPath expression to be evaluated, supplied as a string.XPathException
- if the syntax of the expression is wrong, or if it references namespaces,
variables, or functions that have not been declared.public void setNamespaceResolver(NamespaceResolver namespaceContext)
namespaceContext
- The namespace contextpublic NamespaceResolver getNamespaceResolver()
setNamespaceResolver(net.sf.saxon.om.NamespaceResolver)
public void setDefaultElementNamespace(java.lang.String uri)
uri
- The namespace to be used to qualify unprefixed element names and type names appearing
in the XPath expression.public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception