Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] New XPath issue: what to do with non-nodes?

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: John Cowan <cowan AT ccil.org>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] New XPath issue: what to do with non-nodes?
  • Date: Thu, 13 Jan 2005 11:06:11 -0500

John Cowan wrote:


There is no problem in handling this pattern in a type-safe way.
You just need an XPathResult class with four extraction methods:
double doubleValue(), String stringValue(), boolean booleanValue(),
and Nodes nodelistValue().


That's exactly the ugliness I'm trying to avoid: defining a new type wrapper that has to be unwrapped before you can do anything with it. XOM's been assiduously avoiding casts since day one. I have little desire to reintroduce casting in the guise of function calls.

All I'm trying to do with the query method is provide a nice little language for quickly searching an XML document without writing a lot of rigid, fragile, error-prone navigation code. My assumption is arithmetic, logic and string operations will be done in Java, a language much better suited to them than XPath ever was. If there's really a strong desire to to do this sort of stuff in XPath, then perhaps I can add a nu.xom.xpath package that provides all this, and variables, and compiled expressions, and all the other bells and whistles everyone has asked for. But I still want a nice, simple, little query method in the Node class that doesn't have these issues.

--
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