public class XPathExecutable
extends java.lang.Object
XPathSelector
.
An XPathExecutable is immutable, and therefore thread-safe. It is simplest to load a new XPathSelector each time the expression is to be evaluated. However, the XPathSelector is serially reusable within a single thread.
An XPathExecutable is created by using the XPathCompiler.compile(java.lang.String)
method
on the XPathCompiler
class.
Modifier | Constructor and Description |
---|---|
protected |
XPathExecutable(XPathExpression exp,
Processor processor,
IndependentContext env) |
Modifier and Type | Method and Description |
---|---|
Step<XdmItem> |
asStep()
Treat the compiled XPath expression as a
Step , so that it can be used in a call on
XdmValue.select(net.sf.saxon.s9api.streams.Step<T>) . |
OccurrenceIndicator |
getRequiredCardinalityForVariable(QName variableName)
Get the required cardinality of a declared variable in the static context of the expression.
|
ItemType |
getRequiredItemTypeForVariable(QName variableName)
Get the required item type of a declared variable in the static context of the expression.
|
OccurrenceIndicator |
getResultCardinality()
Get the statically-determined cardinality of the result of the expression.
|
ItemType |
getResultItemType()
Get the ItemType of the items in the result of the expression, as determined by static analysis.
|
XPathExpression |
getUnderlyingExpression()
Get the underlying implementation object representing the compiled XPath expression.
|
StaticContext |
getUnderlyingStaticContext()
Get the underlying implementation object representing the static context of the compiled
XPath expression.
|
java.util.Iterator<QName> |
iterateExternalVariables()
Get an iterator over the names of all the external variables.
|
XPathSelector |
load()
Load the compiled XPath expression to prepare it for execution.
|
protected XPathExecutable(XPathExpression exp, Processor processor, IndependentContext env)
public XPathSelector load()
public Step<XdmItem> asStep()
Step
, so that it can be used in a call on
XdmValue.select(net.sf.saxon.s9api.streams.Step<T>)
.
Example usage: node.select(c.compile(".//x[a=b+2]").asStep()).asXdmValue()
public ItemType getResultItemType()
public OccurrenceIndicator getResultCardinality()
public java.util.Iterator<QName> iterateExternalVariables()
If the allowUndeclaredVariables option is set, this method allows discovery of the variable references that appear in the compiled expression.
public ItemType getRequiredItemTypeForVariable(QName variableName)
variableName
- the name of a declared variableIf the variable was explicitly declared, this will be the item type that was set when the
variable was declared. If no item type was set, it will be ItemType.ANY_ITEM
.
If the variable was implicitly declared by reference (which can happen only when the
allowUndeclaredVariables option is set), the returned type will be ItemType.ANY_ITEM
.
If no variable with the specified QName has been declared either explicitly or implicitly, the method returns null.
public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName)
variableName
- the name of a declared variableIf the variable was explicitly declared, this will be the occurrence indicator that was set when the
variable was declared. If no item type was set, it will be OccurrenceIndicator.ZERO_OR_MORE
.
If the variable was implicitly declared by reference (which can happen only when the
allowUndeclaredVariables option is set), the returned type will be
OccurrenceIndicator.ZERO_OR_MORE
.
If no variable with the specified QName has been declared either explicitly or implicitly, the method returns null.
public XPathExpression getUnderlyingExpression()
public StaticContext getUnderlyingStaticContext()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.