[jdom-interest] Moving Subtrees using JDOM

Jason Hunter jhunter at acm.org
Sat Feb 23 10:59:30 PST 2002


Elliotte Rusty Harold wrote:
> 
> At 5:57 AM -0800 2/23/02, Noam Tamim wrote:
> 
> >So how about adding the suggested elt.addContent(List) that will iterate over
> >
> >that list, do all the casts needed, detach whatever needs detaching, then add
> >it to elt?
> >Should be a simple method, I think. Only thing to consider is if it should be
> >a method of Element, or a utility method in jdom.contrib.
> >
> 
> Either way, this is tricky. For instance, what if something in the
> list doesn't need to be detached?

Well, detach() is a no-op for parentless objects.

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.

-jh-



More information about the jdom-interest mailing list