Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicContext

Class DynamicError

Class EmptyEnumerator

Class ExtensionFunctionCall

Class ExtensionFunctionDefinition

Class NullDestination

Class ParameterDetails

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class Serializer

Class StandardLogger

Class StaticContext

Class StaticError

Class TextWriterDestination

Class TreeProtector

Class XPathCompiler

Class XPathExecutable

Class XPathSelector

Class XQueryCompiler

Class XQueryEvaluator

Class XQueryExecutable

Class XdmAnyFunctionType

Class XdmAnyItemType

Class XdmAnyNodeType

Class XdmAtomicType

Class XdmAtomicValue

Class XdmDestination

Class XdmEmptySequence

Class XdmFunctionItem

Class XdmItem

Class XdmItemType

Class XdmNode

Class XdmNodeKind

Class XdmSequenceType

Class XdmValue

Class XmlDestination

Class Xslt30Transformer

Class XsltCompiler

Class XsltExecutable

Class XsltPackage

Class XsltTransformer

Enum RecoveryPolicy

Enum SchemaValidationMode

Enum TreeModel

Enum WhitespacePolicy

Enum XdmAxis

Interface IMessageListener

Interface IQueryResolver

Interface IResultDocumentHandler

Interface IXdmEnumerator

Interface IXmlLocation

Interface SchemaResolver

 

Saxon.Api
Class XPathExecutable


public class XPathExecutable
implements object

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 one of the Compile methods 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 XPathCompiler, and (if the AllowUndeclaredVariables option was set) variables that are referenced within the expression but not explicitly declared.

 char GetRequiredCardinalityForVariable(QName variableName)

Get the required cardinality of a declared variable in the static context of the expression. The occurrence indicator, one of '?' (zero-or-one), '*' (zero-or-more), '+' (one-or-more), ' ' (a single space) (exactly one), or 'º' (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 {@link 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 {@link OccurrenceIndicator#ZERO_OR_MORE}. If no variable with the specified QName has been declared either explicitly or implicitly, the method returns 0.

 XPathSelector Load()

Load the compiled XPath expression to prepare it for execution.

 
Method Detail

EnumerateExternalVariables

public IEnumerator EnumerateExternalVariables()

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
An IEnumerator over the names of the external variables, as instances of QName.

GetRequiredCardinalityForVariable

public char GetRequiredCardinalityForVariable(QName variableName)

Get the required cardinality of a declared variable in the static context of the expression. The occurrence indicator, one of '?' (zero-or-one), '*' (zero-or-more), '+' (one-or-more), ' ' (a single space) (exactly one), or 'º' (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 {@link 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 {@link 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 variable
returns
the required cardinality.

Load

public XPathSelector Load()

Load the compiled XPath expression to prepare it for execution.

returns
An XPathSelector. The returned XPathSelector can be used to set up the dynamic context, and then to evaluate the expression.