[jdom-interest] insertChild in Element

Jason Hunter jhunter at collab.net
Thu Aug 31 07:02:54 PDT 2000


> How would you feel if the function were like this:
> 
> element.addChild(3, newElement);
> 
> Of course, given the current API in the CVS, it might be named
> "addContent" instead, which isn't quite as clear, but shouldn't be 
> a major stumbling block.

This is all a matter of style, but I personally don't see a point in
adding methods to Element that duplicate functionality that's readily
available in other ways.  If you went this way you'd need various adds,
various removes, various clears, various inserts, and you'd fully
confuse the functionality of Element.  We have tried to keep the bare
minimum for calling convenience -- things that aren't easily done with
the list like removing all children with a given name -- but everything
else can be done through the List interface.

It's true the docs need to be ultra-clear that the lists are "live", and
I added that material to the javadocs during the change we had last
month.

-jh-



More information about the jdom-interest mailing list