← Prev in month ← Prev in thread

Document order calculation

From
Elliotte Harold <>
To
XML Developers List <>
Date
2005-02-27T20:49:02Z
ID
<>
Thread
Document order calculation
I'm wondering if anyone knows an efficient algorithm for comparing two 
nodes for document order? I'm looking for something better than simply 
walking the tree from beginning to end and seeing which node appears 
first. Assumptions are:

1. XPath 1.0 data model or rough equivalent

2. Usual navigation operations like getParent(), getChild(), etc. such 
as might be found in XSLT 1, DOM Level 2, JDOM, XOM, etc. (i.e. I don't 
want to rely on the extensions to do exactly this in XPath 2/XSLT 
2/XQuery and in DOM Level 3)

-- 
Elliotte Rusty Harold  
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
← Prev in month ← Prev in thread