W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

RE: Older Sibling?

From: <keshlam@us.ibm.com>
Date: Tue, 29 Feb 2000 13:52:07 -0500
To: www-dom@w3.org
Message-ID: <85256894.0067A6CF.00@D51MTA03.pok.ibm.com>
> Given that XML is ordered, it does seem pretty strange to not be able to
> determine what order any given two things are in.

Being ordered, and being able to easily extract ordering information, are
two different things.

All the information required does already exist in the DOM API, though not
in a convenient form:

     Make sure the two nodes aren't the same node
          (if they are, neither preceeds the other)
     Find lowest common ancestor of the two nodes
     Walk its immediate children left to right
     Stop when you find the first child whose subtree contains one of the
          two nodes. That node comes before the other.

Implementation is left as an exercise for the reader.


We don't currently define a single-step query which _only_ returns the
who-comes-first information. (Nor does the Infoset, as far as I know.)

As has been noted there may be reason to add this, both for convenience and
because some DOMs may be able to offer a faster implementation based on
internal knowledge. But it doesn't necessarily have to be added in Level 2,
since the do-it-yourself calculation does work.

Certainly worth further consideration. It's been placed on the open issues
list.


______________________________________
Joe Kesselman  / IBM Research
Received on Tuesday, 29 February 2000 13:55:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT