[jdom-interest] detach() [eg]

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Tue Apr 24 23:32:47 PDT 2001

I agree, however the whole substance of JDOM seems to be that children know
about their parents. Which is very strange imo.

-----Original Message-----
From: Scott Means [mailto:smeans at moonlightideas.com]
Sent: 24 April 2001 01:00
To: jdom-interest at jdom.org
Subject: [jdom-interest] detach() [eg]

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)

To control your jdom-interest membership:

More information about the jdom-interest mailing list