[jdom-interest] Moving Subtrees using JDOM

bob mcwhirter bob at werken.com
Sat Feb 23 12:45:01 PST 2002

> The downside with the auto-detach idea is that addContent(Element)
> doesn't auto-detach and will throw if you try to add a parented object. 
> addContent(List) shouldn't behave differently.  And my gut instinct is
> addContent(Element) shouldn't be changed to remove children from
> parents.

I disagree.  

I've seen naive programmer create an Element, and then attempt to
re-use it (across threads, or whatnot) and attach it to multiple
documents.  With the exception, the problem became clear rather
quickly.  Without an exception, using auto-reparenting, you'd
simply end up with documents that didn't contain the Element
you thought you'd added (and never explicitly removed).


More information about the jdom-interest mailing list