[jdom-interest] Moving Subtrees using JDOM

Jason Hunter jhunter at acm.org
Fri Feb 22 12:08:51 PST 2002

Joan Roch wrote:
> >Kind of like:
> >
> >elt.getContent().addAll(otherelt.getContent())
> >
> >Except the content being moved will have parents so this won't work
> >exactly.  You'll have to iterate over them and detach each before the
> >move.  Might as well just set up an iterator and do a detach/add for
> >each right there.
> This implies to identify each object (using "instanceof") in the list and then cast thoses objects into their specific classes because detach() is not defined in an interface common to each Object found in a JDOM tree... sigh. Maybe it would be a good idea to define an interface for all those objects that can be found in a JDOM tree.

Yes, this is one situation where that would be really nice.  But I'm too
busy to start that debate again just now.


More information about the jdom-interest mailing list