Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] General comment and specific question concerning element lookup

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: <hal AT idi.ntnu.no>, <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] General comment and specific question concerning element lookup
  • Date: Thu, 19 Sep 2002 09:58:53 -0400

At 10:32 AM +0200 9/19/02, Hallvard TrÊtteberg wrote:

As a start I've written a Swing TreeModel for XOM, which was fairly easy (as
for JDOM). There were two kinds of methods I missed, one for returning the
number of Element children of an Element (without going through Elements
getChildElements),

What don't you like about element.getChildElements().size()?

the other for Element lookup, e.g.
Element.indexOfElement(Element e) or TreeNode.indexOfNode(Node n), to find
the position of a child node.

Can you be a little clearer about the use-case for this one? It seems to me that it's a bit of a special need. Since it can be done in a utility method provided by client code or in a special purpose subclass that adds this functionality, I'd rather not add it to the core API unless I see a *lot* of call for it.

I can see that this might be useful in JDOM because of its list-based navigation. However, in XOM the examples I can think of could be better handled by getNextSibling()/getPreviousSibling() without needing to know the exact index.
--

+-----------------------+------------------------+-------------------+
| 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