Saxon.Api
Class XPathExecutable
-
public class XPathExecutable
An XPathExecutable
represents the compiled form of an XPath expression.
To evaluate the expression, it must first be loaded to form an 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 Compile
method on the XPathCompiler
class.
Method Summary |
|
---|---|
IEnumerator | EnumerateExternalVariables()
Get a list of external variables used by the expression. This will include both variables
that were explicitly
declared to the |
IEnumerator<QName> | EnumerateExternalVariables2()
Get a list of external variables used by the expression. This will include both variables
that were explicitly
declared to the |
char | GetRequiredCardinalityForVariable(QName variableName) Get the required cardinality of a declared variable in the static context of the expression. |
XPathSelector | Load() Load the compiled XPath expression to prepare it for execution. |
Method Detail
EnumerateExternalVariables
EnumerateExternalVariables2
Get a list of external variables used by the expression. This will include both variables
that were explicitly
declared to the XPathCompiler
, and (if the AllowUndeclaredVariables
option was set) variables that
are referenced within the expression but not explicitly declared.
Returns:
IEnumerator
over the names of the external variables, as instances of QName
.
GetRequiredCardinalityForVariable
Get the required cardinality of a declared variable in the static context of the expression.
The result is given as an occurrence indicator, one of:
- '?' (zero-or-one)
- '*' (zero-or-more)
- '+' (one-or-more)
- ' ' (a single space) (exactly one)
- 'º' (masculine ordinal indicator, xBA) (exactly zero)
The type empty-sequence()
can be represented by an occurrence indicator of 'º' with
any item type.
If 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 net.sf.saxon.s9api.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
net.sf.saxon.s9api.OccurrenceIndicator#ZERO_OR_MORE.
If no variable with the specified QName
has been declared either explicitly or implicitly,
the method returns '0'.
Parameters:
variableName
- the name of a declared variableReturns:
Load
Load the compiled XPath expression to prepare it for execution.
Returns:
XPathSelector
. The returned XPathSelector
can be used to
set up the dynamic context, and then to evaluate the expression.
Get a list of external variables used by the expression. This will include both variables that were explicitly declared to the
XPathCompiler
, and (if theAllowUndeclaredVariables
option was set) variables that are referenced within the expression but not explicitly declared.Returns:
IEnumerator
over the names of the external variables, as instances ofQName
.