At 4:23 PM -0500 3/18/02, bob mcwhirter wrote:
>The evaluate(...) method tends to match the requirements of the >actual XPath function signature, for the most part. > >evaluate(...) isn't consistent across all functions, because the >actual parameter list isn't consistent across all of the core >XPath functions. > >I'd say they are different because they need to be. Am I misunderstanding >your statement? > 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 example, the XPath signature of count is: number count(node-set) Based on this I'd expect that CountFunction.evaluate() take a List as an argument. Instead it takes an Object. Why? public static Number evaluate(Object obj) 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) 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? 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) 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. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | [EMAIL PROTECTED] | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest