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: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: "'Bradley S. Huffman'" <hip AT a.cs.okstate.edu>, xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.1: XPath
  • Date: Mon, 10 Jan 2005 05:57:57 -0500

Wolfgang Hoschek wrote:

Well, it would be helpful if you could state why this is "clearly correct".

The XPath data model does not allow adjacent text nodes. According to the spec,

"As much character data as possible is grouped into each text node: a text node never has an immediately following or preceding sibling that is a text node."

Getting this right is critical for making sure that positional predicates do what you expect, and not introducing off-by-one-or-more errors. There are other issues as well, but positional predicates are the ones that are going to come up most frequently.

Hmm, looking at the spec I see one other tricky bit we have to watch out for:

"A text node always has at least one character of data."

In other words, empty Text objects cannot be selected. That's going to be tricky to implement. Time to write a test case.


I'll add the following method to the next Nux release candidate, unless a convincing argument can be made that one can easily do without it:

I suspect this method might be useful in and of itself, irrespective of XPath issues. I'd say go ahead and add it.

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