[jdom-interest] detach() [eg]

Scott Means smeans at moonlightideas.com
Mon Apr 23 21:06:49 PDT 2001


I agree with Elliotte. I think having the parent detach its children is
cleaner than requiring the children to be familiar with their parents
(almost incestuous :) Also, and I don't know if this will win any points
with this crowd, it does match how the W3C DOM API works:

Node removeChild(Node oldChild)
Removes the child node indicated by oldChild from the list of children, and
returns it.

Node replaceChild(Node newChild, Node oldChild)
Replaces the child node oldChild with newChild in the list of children, and
returns the oldChild node.
 
If you are going to move this functionality to the parent, it might even
make sense to rename the method to conform to the DOM method. It does seem
a little clearer to me that I'm removing a child, rather than detaching a
child. It would also fit with your getChild() method name.


=======================================
Scott Means (smeans at moonlightideas.com)





More information about the jdom-interest mailing list