Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicContext

Class DynamicError

Class EmptyEnumerator

Class ExtensionFunctionCall

Class ExtensionFunctionDefinition

Class NullDestination

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class Serializer

Class StaticContext

Class StaticError

Class TextWriterDestination

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 XdmItem

Class XdmItemType

Class XdmNode

Class XdmNodeKind

Class XdmSequenceType

Class XdmValue

Class XmlDestination

Class XsltCompiler

Class XsltExecutable

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 ExtensionFunctionCall


public abstract class ExtensionFunctionCall
implements object

An instance of this class will be created by the compiler for each function call to this extension function that is found in the source code. The class is always instantiated by calling the method MakeFunctionCall() of the corresponding ExtensionFunctionDefinition. The implementation may therefore retain information about the static context of the call. Once compiled, however, the instance object must be immutable.


Method Summary
 void SupplyStaticContext(StaticContext context)

Method called by the compiler (at compile time) to provide information about the static context of the function call. The implementation may retain this information for use at run-time, if the result of the function depends on information in the static context.

 void CopyLocalData(ExtensionFunctionCall destination)

A subclass must implement this method if it retains any local data at the instance level. On some occasions (for example, when XSLT or XQuery code is inlined), Saxon will make a copy of an ExtensionFunction object. It will then call this method on the old object, supplying the new object as the value of the argument, and the method must copy all local data items from the old object to the new.

 IXdmEnumerator Call(Saxon.Api.IXdmEnumerator[] arguments, DynamicContext context)

Method called at run time to evaluate the function.

 
Method Detail

SupplyStaticContext

public virtual void SupplyStaticContext(StaticContext context)

Method called by the compiler (at compile time) to provide information about the static context of the function call. The implementation may retain this information for use at run-time, if the result of the function depends on information in the static context.

For efficiency, the implementation should only retain copies of the information that it actually needs. It is not a good idea to hold a reference to the static context itself, since that can result in a great deal of compile-time information being locked into memory during run-time execution.

Parameters:
context -
Information about the static context in which the function is called

CopyLocalData

public virtual void CopyLocalData(ExtensionFunctionCall destination)

A subclass must implement this method if it retains any local data at the instance level. On some occasions (for example, when XSLT or XQuery code is inlined), Saxon will make a copy of an ExtensionFunction object. It will then call this method on the old object, supplying the new object as the value of the argument, and the method must copy all local data items from the old object to the new.

Parameters:
destination -
The new extension function object. This will always be an instance of the same class as the existing object.

Call

public abstract IXdmEnumerator Call(Saxon.Api.IXdmEnumerator[] arguments,
            DynamicContext context)

Method called at run time to evaluate the function.

Parameters:
arguments -
The values of the arguments to the function, supplied as iterators over XPath sequence values.
context -
The dynamic context for evaluation of the function. This provides access to the context item, position, and size, and if required to internal data maintained by the Saxon engine.
returns
An iterator over a sequence, representing the result of the extension function. Note that Saxon does not guarantee to read this sequence to completion, so calls on the iterator must have no side-effects. In rare circumstances (for example, when last() is used) Saxon may clone the returned iterator by calling its GetAnother() method, allowing the function results to be read more than once.