commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Neumcke <>
Subject [JXPath] Custom Extension Functions
Date Wed, 19 Mar 2003 15:57:02 GMT
Hi Dimitri,
thanks for implementing the Relative Context - we switched to Version 1.1
and it works like a charm!

I've got two new questions concerning "Custom Extension Functions":

* registering
Registering extension functions with context objects works fine. 
In the API-Doc of ClassFunctions it is mentioned, that you can register
functions globally by calling 'new ClassFunctions(Integer.class, "int")'. In
the default implementation of JXPathContext the generic functions are
created with null as namespace, and this seems to prevent generic functions
from returning anything but null:
private static final PackageFunctions GENERIC_FUNCTIONS = new
PackageFunctions("", null);
Did I miss something?

* return values
I managed to write a function that returns an Integer for later use, e.g.
'[ws:myFunc()]. How would I return Nodes/Pointers/whatever for later
evaluation, e.g. '[count(ws:myFunc()/preceding-sibling::*)]? What type
should my function return?

Thanks for your help,


View raw message