An XPath extension for use under XMLProbe must implement org.jaxen.Function (http://jaxen.org/apidocs/org/jaxen/Function.html).
The method Function#call() should for best results return a node-set, represented by a java.util.List.
Extension functions with a default/no-arg constructor can be loaded from the XML configuration file using this syntax:
<probe:addIn xmlns:probe='http://xmlprobe.com/200312'> <probe:name>com.xmlprobe.QAHandler</probe:name> <probe:feature> <probe:name>http://xmlprobe.com/features/xpath-extension-function</probe:name> <probe:value>[classname of function to be loaded]</probe:value> <probe:alias>[name of XPath function]</probe:alias> </probe:feature> <!--...more features here...--> </probe:config> </probe:addIn>
The element <probe:alias> is not required. If omitted, the classname specified in <probe:value> is used as the registered name of the extension function.
Extension functions whose constructor takes arguments must be loaded from a subclass of com.xmlprobe.QAHandler. To do this, create an instance of the function and register it with the current org.jaxen.FunctionContext, accessible via QAHandler#functionContext(), e.g.:
MyExtensionFunction f = new MyExtensionFunction( arg1, arg2 ); //constructor takes args functionContext().registerFunction( namespaceURI, "my-ext-func", f );