Project

Profile

Help

Invoking XQuery user-defined functions from Java: What is the supported way forward?

Added by Dave MacDonald about 7 years ago

In this documentation page: http://saxonica.com/html/documentation9.7/using-xquery/callingfunctions.html it describes a method for invoking a user-defined function via UserFunction::call(Sequence [], Controller). However, the code on that page does not compile with 9.7.

The javadoc for net.sf.saxon.Controller also says it is no longer considered a part of the public API.

There is another method UserFunction::call(XPathContext, Sequence[]), but it's not clear how to create a new XPathContext instance for the purpose of calling a user-defined function from Java.

What is the recommended way to call XQuery functions from Java now?


Replies (1)

RE: Invoking XQuery user-defined functions from Java: What is the supported way forward? - Added by Michael Kay about 7 years ago

Thanks for pointing out this obsolete documentation.

Calling external functions is now supported using the s9api method XQueryEvaluator.callFunction(FunctionName, args). Unlike the old mechanism in StaticQueryContext, this is properly type-checked (in fact the function conversion rules are applied to the supplied arguments)

    (1-1/1)

    Please register to reply