net.sf.saxon.sxpath
public class XPathEvaluator extends Object
Since: 8.4
Constructor Summary | |
---|---|
XPathEvaluator()
Default constructor. | |
XPathEvaluator(Configuration config)
Construct an XPathEvaluator with a specified configuration. |
Method Summary | |
---|---|
NodeInfo | build(Source source)
Build a source document.
|
XPathExpression | createExpression(String expression)
Prepare (compile) an XPath expression for subsequent evaluation. |
XPathExpression | createPattern(String pattern)
Prepare (compile) an XSLT pattern for subsequent evaluation. |
XPathVariable | declareVariable(String uri, String localName)
Declare a variable, making it available for use within a subsequently-compiled XPath expression.
|
Configuration | getConfiguration()
Get the Configuration in use. |
Executable | getExecutable()
Get the executable |
NamespaceResolver | getNamespaceResolver()
Get the external namespace resolver, if one has been set using |
XPathStaticContext | getStaticContext()
Get the current static context. |
static void | main(String[] args)
For testing only |
void | setDefaultElementNamespace(String uri)
Set the default namespace for elements and types |
void | setNamespaceResolver(NamespaceResolver namespaceResolver)
Set the external namespace resolver to be used. |
void | setStaticContext(XPathStaticContext context)
Set the static context for compiling XPath expressions. |
void | setStripSpace(boolean strip)
Indicate whether all whitespace text nodes in source documents are to be
removed. |
Parameters: 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 com.saxonica.config.EnterpriseConfiguration
Deprecated: since 8.9. The preferred way to build a source document is to use Configuration
Build a source document.This method is retained for backwards compability. The preferred way to build a document tree is to call the method Configuration
Parameters: 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. For the way in which the source document is built, see Configuration
Returns: the NodeInfo representing the root of the constructed tree.
Throws: XPathException if, for example, XML parsing fails.
Parameters: expression The XPath expression to be compiled, supplied as a string.
Returns: an XPathExpression object representing the prepared expression
Throws: XPathException if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared.
Parameters: pattern the XSLT pattern to be compiled, supplied as a string
Returns: an XPathExpression object representing the pattern, wrapped as an expression
Throws: XPathException if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared.
Since: 9.1
Parameters: uri The namespace URI of the variable name. Use "" for the null namespace. localName The local part of the variable name.
Returns: an object representing the variable
Returns: the Saxon configuration
Returns: the executable. This holds details of function bindings and collations.
Returns: the namespace resolver supplied by the user if set, or a system-defined namespace resolver otherwise. By default, the IndependentContext object used as the XPathStaticContext also acts as the NamespaceResolver.
Returns: the static context object
Parameters: uri The namespace to be used to qualify unprefixed element names and type names appearing in the XPath expression.
Parameters: namespaceResolver The namespace resolver, which maintains a mapping of prefixes to URIs. Any namespace prefix used in the XPath expression is resolved using this namespaceResolver.
Parameters: context the XPath static context
Setting a new static context clears any variables and namespaces that have previously been declared.
Deprecated: since 8.9. The preferred way to build a source document is to use Configuration
Indicate whether all whitespace text nodes in source documents are to be removed. This affects the action of the XPathEvaluator method, and of all other methods that take a Source as input.Parameters: 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.