[jdom-interest] document order of elements
Elliotte Rusty Harold
elharo at metalab.unc.edu
Sat Aug 26 06:54:02 PDT 2000
At 1:49 PM -0700 8/25/00, Jason Hunter wrote:
>> And I guess, since folks can construct Elements and assemble Documents
>> in whatever fashion they choose, we can't use a serial-number on
>> Element.
>
>Yep.
>
>> Is there anything, currently, that'll walk the tree, and give me
>> an in-order java.util.List of the elements? (Flattening the tree,
>> effectively).
>
>I could imagine a method like Document.getTraversalIterator() that
>returned an Iterator that walked all Elements. Maybe there'd be a
>similar method on Element too to talk all its kids, since that
>functionality would need to be there to support the document method.
>
This is the sort of stuff that really isn't that hard to write
yourself if you actually need it. I wouldn't want to clutter the main
JDOM API with this. If a lot of people really want it, maybe we could
add a separate org.jdom.traversal package like the DOM has? But
frankly, I'd still need convincing even for this.
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list