Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] prefixChild?

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 <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] prefixChild?
  • Date: Sun, 04 May 2003 09:26:33 -0400

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

public void prefixChild(Node child)

This would insert a new Node at the beginning of the parent's list rather than the end. I got this idea because I noticeds that in my sample code, 9 times out of 10 when parent.insertChild(n, node) is called, n is equal to 0.

The downside is twofold:

1. It's an extra method that doesn't due anything that's all that hard to do now, and you know how I hate those. :-)

2. For some reason, "prefixChild" just doesn't sound as natural to me as "appendChild". It's not immediately obvious what this method does from the name. insertAtBeginning is too cumbersome. insert(Node) does not make it obvious that the insertion takes place at the beginning of the list. Perhaps if anyone could suggest a better name for this method, it might be more palatable.

Thoughts?

--
Elliotte





Archive powered by MHonArc 2.6.24.

Top of Page