> Perhaps. I'm not talking about all the evaluate methods. I understand > that they do need different argument lists and return types, because > the different XPath functions they represent have different argument > lists and return types. However, in those places where an XPath > function is declared to take a node-set as an argument, Jaxen uses > about three different ways of representing that node-set. Sometimes > it expects an Object, sometimes a List and a Navigator, sometimes a > Context.
For the List vs. Object, I'm not certain. I'll need to crawl around in the code. > The local-name() function in XPath is declared thusly: > > string local-name(node-set?) > > Based on that I'd expect two evaluate methods, one that takes an > Object and one that takes a List. Instead I see > > public static String evaluate(List list, Navigator nav) Yah. I think that categorically, evaluate(...) has been overloaded too much, sometimes. The List parameter sometimes refers to a NodeSet, and sometimes refers to the argument-list. Definitely need to go through and do some cleaning. Mostly you'll see this on functions that have (node-set?) as the parameter, where if there's an argument, you use it, else, you use the current context node-set. > > It's not clear why the Navigator is there at all. And why does one of > these functions represent a node-set as an Object and the other as a > List? Navigator is there because at some point, it has to extract the local-name from the node. That's implementation-specific, and thus requires the Nav to satisfy the question. I'm not certain what's up with count(). I think a List would be appropriate. > The XPath sum() function also operates on a single node-set. However, > the Jaxen representation here mixes up the two previous > representations with an Object and a Navigator: > > public static Double evaluate(Object obj, Navigator nav) Again, I think you're right that this should take a List. Still requires the navigator, though, because the convert-to-number aspect of the function requires implementation-specific information available only through the Navigator. > Given an XPath function that takes a node-set as an argument, I can't > figure out how to guess what types Jaxen will use to pass that > node-set as an argument to evaluate(). If a node-set is indeed > supposed to be represented by a List, then all these methods should > probably take a single List as an argument. Just curious, but... Are you looking at these aspects of the code because you want to use them directly, or because you're just checking out the general quality (or lack thereof) of it? The AverageUser(tm) will never look at this stuff. Of course, that's no excuse for it to be confusing, but... -bob _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest