From: "James Strachan" <[EMAIL PROTECTED]> > > e.g. lets say your Element nodes have a method called foo() on them. > > We could do > > foo(/some/thing)/else > > Then the global XPath function foo() could iterate over the nodeset of > /some/thing and call the foo() method on each Element node and return a > result set. > > If you're Element.foo() method took parameters then these could follow in > the global foo() XPath function. e.g. > > foo(/some/thing, 'abc')/else > > would call > > Element.foo( "abc" ) > > on each node that matches /some/thing. > > So I think you can do exactly what you want - its just that you need to > create a global XPath function to call the instance method on the Element. > Indeed you could just write a generic XPath function and NamespaceContext > that attempts to use reflection to call all available methods on your > Element class automatically, so you only need to write one XPath function if > you see what I mean.
Actually Halvard this is really interesting. Using this technique we could possibly allow methods to be invoked on individual nodes while still using the standard XPath syntax. I'm not sure what kinds of methods we'd want to call but its interesting none the less ;-). Once I finally get around to writing the Java Beans navigator using the Betwixt metadata... http://jakarta.apache.org/commons/betwixt.html we could use this technique to allow arbitrary java method calls on objects while maintaining XPath syntax. James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest