Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] prefixChild?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Bradley S. Huffman" <hip AT a.cs.okstate.edu>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] prefixChild?
  • Date: Sun, 04 May 2003 10:19:03 -0500

Elliotte Rusty Harold writes:

> While clearing out some old TODO items, I noticed one interesting idea.
> Should there be a prefixChild() method in ParentNode to complement
> appendChild()?

appendChild is good because without it you'd have to first ask if the parent
has any children and how many. Which is what happens internally, but
appendChild is such a clean and obvious one liner. I don't have any numbers
to back it up, but I'm guessing appendChild is the method used 90% of the
time for adding content, so it makes a good convenience method.

Inserting anywhere else in the list, including the front, you already know
the index you want and insertChild(index, node) provides a nice obvious one
liner, IMHO. -1 from me for a convenience method to add to the front of the
list.

Brad




Archive powered by MHonArc 2.6.24.

Top of Page