public class XPathEvaluator
extends java.lang.Object
XPathEvaluator
it exposes Saxon classes and interfaces
and thus provides a more strongly-typed interface with greater control over the detailed behaviour.
However, the preferred API for user applications calling XPath is the s9api XPathCompiler
interface.
Constructor and Description |
---|
XPathEvaluator()
Default constructor.
|
XPathEvaluator(Configuration config)
Construct an XPathEvaluator with a specified configuration.
|
Modifier and Type | Method and Description |
---|---|
XPathExpression |
createExpression(java.lang.String expression)
Prepare (compile) an XPath expression for subsequent evaluation.
|
XPathExpression |
createPattern(java.lang.String pattern)
Prepare (compile) an XSLT pattern for subsequent evaluation.
|
Configuration |
getConfiguration()
Get the Configuration in use.
|
XPathStaticContext |
getStaticContext()
Get the current static context.
|
protected Expression |
postProcess(Expression exp,
ExpressionVisitor visitor,
ContextItemStaticInfo cit)
Customize the expression post-optimization.
|
void |
setStaticContext(XPathStaticContext context)
Set the static context for compiling XPath expressions.
|
public XPathEvaluator()
Configuration
that is implicitly created by this constructor,
which is accessible using the getConfiguration()
method.public XPathEvaluator(Configuration config)
config
- the configuration to be used. If the XPathEvaluator is
to be used to run schema-aware XPath expressions this must be an instance
of EnterpriseConfiguration
public Configuration getConfiguration()
public void setStaticContext(XPathStaticContext context)
IndependentContext
class.
Until this method is called, a default static context is used, in which no namespaces are defined
other than the standard ones (xml, xslt, and saxon), and no variables or functions (other than the
core XPath functions) are available.context
- the XPath static context
Setting a new static context clears any variables and namespaces that have previously been declared.
public XPathStaticContext getStaticContext()
IndependentContext
public XPathExpression createExpression(java.lang.String expression) throws XPathException
expression
- The XPath expression to be compiled, 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.protected Expression postProcess(Expression exp, ExpressionVisitor visitor, ContextItemStaticInfo cit) throws XPathException
exp
- the expression after optimizationvisitor
- an expression visitor that includes static context informationcit
- information about the context item typeXPathException
public XPathExpression createPattern(java.lang.String pattern) throws XPathException
pattern
- the XSLT pattern to be compiled, supplied as a stringXPathException
- if the syntax of the expression is wrong, or if it references namespaces,
variables, or functions that have not been declared.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.