Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] The mysterious LeafNode class

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] The mysterious LeafNode class
  • Date: Fri, 20 Sep 2002 14:09:10 -0400

At 9:11 AM -0500 9/20/02, Bradley S. Huffman wrote:
My reason would be that children have order so previous and next make
sense. Attributes are unordered so previous and next don't. BTW, I did
this with a experimental version of JDOM and to me it just wasn't that
usefull and one method to obtain a List or array of attributes was
good enough.


I'm in radical agreement that attributes don't have order, and that we can't reproduce order from input. However, there are many use cases in which you do not know a priori the names of the attributes on any given element (XSLT and XInclude to name two). Thus it is useful and necessary to retrieve the complete set of attributes from an element.

Having done so, you need some means of iterating across this set. Currently, I provide this with indexed access, though the JavaDocs are careful to say that the index is not significant. Is getNextSibling/getPreviousSibling somehow worse than this? Given that I don't know the attribute names, is there any way I could provide access to all the attributes of an element without somehow imposing an external, perhaps arbitrary, order on them?

The only thing I can think of is providing a list of the names, which could then be used as indexes into the set of attributes. However, that just moves the external, arbitrary order into the list of names. It doesn't really address the concern.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page