Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.1: XPath

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Michael Kay <mike AT saxonica.com>
  • Cc: 'xom-interest' <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XOM 1.1: XPath
  • Date: Fri, 07 Jan 2005 07:19:21 -0500

Michael Kay wrote:

I would encourage you to design the API so that it extends to anything XPath
2.0 can throw at you even if you initially implement only a subset of XPath
1.0. I think the right way to do this is to have methods that are specific
to the return type expected:

List<Node> XPath.selectNodeSequence("*")
Node XPath.selectNode("..")
double XPath.selectDouble("count(*)")
String XPath.selectString("name(..)")
boolean XPath.selectBoolean("name(..) = 'banana')

This is just where Java's string-typedness mismatches with XSLT's weak-typedness. This isn't bad. I am worried that selectNode and selectNodeSequence blow up when the expression returns a String/double/boolean.

The complexity of it worries me, especially when you do consider XPath 2 where there are many more types that might be returned.


--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page