Saxon.Api

 

 

Saxon.Api

Interface ExtensionFunction


public interface ExtensionFunction

This is an interface for simple external/extension functions. Users can implement this interface and register the implementation with the Processor; the function will then be available for calling from all queries, stylesheets, and XPath expressions compiled under this Processor.

Extension functions implemented using this interface are expected to be free of side-effects, and to have no dependencies on the static or dynamic context. A richer interface for extension functions is provided via the ExtensionFunctionDefinition class.

Method Summary

 XdmValue Call(XdmValue[] arguments)

Method called at run time to evaluate the function.

 XdmSequenceType[] GetArgumentTypes()

Declare the type of the arguments

 QName GetName()

Return the name of the external function

 XdmSequenceType GetResultType()

Declare the result type of the external function

 

Method Detail

Call

public XdmValue Call(XdmValue[] arguments)

Method called at run time to evaluate the function.

Parameters:

arguments - The values of the arguments supplied in the XPath function call.

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.

GetArgumentTypes

public XdmSequenceType[] GetArgumentTypes()

Declare the type of the arguments

Returns:

an array of XdmSequenceType objects, one for each argument to the function, representing the expected types of the arguments

GetName

public QName GetName()

Return the name of the external function

Returns:

the name of the function, as a QName

GetResultType

public XdmSequenceType GetResultType()

Declare the result type of the external function

Returns:

the result type of the external function