Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] prefixChild?

xom-interest AT

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT>
  • To: xom-interest <xom-interest AT>
  • 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.



Archive powered by MHonArc 2.6.24.

Top of Page