## net.sf.saxon.s9api
Class XPathExecutable

    java.lang.Object
      net.sf.saxon.s9api.XPathExecutable

    public class XPathExecutable

extends java.lang.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 the `XPathCompiler.compile(java.lang.String)` method on the `XPathCompiler` class.

Constructor Summary
`protected` `XPathExecutable(XPathExpression exp, Processor processor, IndependentContext env, java.util.ArrayList<XPathVariable> declaredVariables)`

Method Summary
`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.
`XPathSelector` `load()` Load the compiled XPath expression to prepare it for execution.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XPathExecutable

    protected XPathExecutable(XPathExpression exp,
                              Processor processor,
                              IndependentContext env,
                              java.util.ArrayList<XPathVariable> declaredVariables)

Method Detail

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

### getResultItemType

    public ItemType getResultItemType()

  Get the ItemType of the items in the result of the expression, as determined by static analysis. This is the most precise ItemType that the processor is able to determine from static examination of the expression; the actual items in the expression result are guaranteed to belong to this ItemType or to a subtype of this ItemType.

  Returns:
    the statically-determined ItemType of the result of the expression
  Since:
    9.1

### getResultCardinality

    public OccurrenceIndicator getResultCardinality()

  Get the statically-determined cardinality of the result of the expression. This is the most precise cardinality that the processor is able to determine from static examination of the expression.

  Returns:
    the statically-determined cardinality of the result of the expression
  Since:
    9.1

### getUnderlyingExpression

    public XPathExpression getUnderlyingExpression()

  Get the underlying implementation object representing the compiled XPath expression. This method provides access to lower-level Saxon classes and methods which may be subject to change from one release to the next.

  Returns:
    the underlying compiled XPath expression.

### getUnderlyingStaticContext

    public StaticContext getUnderlyingStaticContext()

  Get the underlying implementation object representing the static context of the compiled XPath expression. This method provides access to lower-level Saxon classes and methods which may be subject to change from one release to the next.

  Returns:
    the underlying static context.

Copyright (c) Saxonica Limited. All rights reserved.