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: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • To: "Michael Kay" <mike AT saxonica.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.1: XPath
  • Date: Fri, 07 Jan 2005 09:22:12 -0600

"Michael Kay" writes:

> Rather than having Saxon create virtual text nodes to represent a sequence
> of adjacent XOM text nodes, I think it would be better if XOM had an option
> to merge adjacent text nodes as soon as they are added to the tree.

JDOM use to do this and it was dropped because it caused confusion with the
index methods. Someone would add or remove a node and the index of the
remaining nodes wouldn't be what they expected. Examples of methods in XOM
that would have this problem are getChild(int index), insert(Node node,
int index), indexOf(), and especially getChildCount() to name a few. In
hindsight, should of keep the merge behavior and dump the methods. If you
want the 2nd child element of a parent node, and unless you take extra
measures to build a index certain nodes or find some other way to keep track
of their positions, you're going to have to search from the first child
anyway.
May as well just use a iterator.

Brad




Archive powered by MHonArc 2.6.24.

Top of Page