Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicContext

Class DynamicError

Class EmptyEnumerator

Class ExtensionFunctionCall

Class ExtensionFunctionDefinition

Class InvalidityHandlerWrapper

Class NamespaceConstant

Class NullDestination

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class Serializer

Class StandardLogger

Class StaticContext

Class StaticError

Class TextWriterDestination

Class WhitespacePolicy

Class XPathCompiler

Class XPathExecutable

Class XPathSelector

Class XQueryCompiler

Class XQueryEvaluator

Class XQueryExecutable

Class XdmAnyFunctionType

Class XdmAnyItemType

Class XdmAnyNodeType

Class XdmArray

Class XdmAtomicType

Class XdmAtomicValue

Class XdmDestination

  - Class TreeProtector

Class XdmEmptySequence

Class XdmExternalObjectValue

Class XdmFunctionItem

Class XdmItem

Class XdmItemType

Class XdmMap

Class XdmNode

Class XdmNodeKind

Class XdmSequenceType

Class XdmValue

Class XmlDestination

Class Xslt30Transformer

Class XsltCompiler

Class XsltExecutable

  - Class ParameterDetails

Class XsltPackage

Class XsltTransformer

Enum RecoveryPolicy

Enum SchemaValidationMode

Enum TreeModel

Enum XdmAxis

Interface IInvalidityHandler

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 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.

 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 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 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.