commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: [JXPath] Custom Extension Functions
Date Tue, 25 Mar 2003 15:00:35 GMT
Peter,

I have fixed the problem with extension functions returning
collections.
You have two options: either return a collection (array, list, set etc)
or a NodeSet.  Check out the new class, BasicNodeSet, which makes it
very busy to build a NodeSet.

Thank you for bringing up this issue.

- Dmitri 

--- Peter Neumcke <pneumcke@virbus.de> wrote:
> 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,
> 
> Peter
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

Mime
View raw message