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 XdmValue, representing the result of the extension function. (Note: in many cases it will be convenient to return an XdmAtomicValue or XdmNode, both of which are instances of XdmValue).

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