[jdom-interest] Moving Subtrees using JDOM

Noam Tamim noamt at yahoo.com
Sat Feb 23 05:57:26 PST 2002

--- Jason Hunter <jhunter at acm.org> wrote:
> > >elt.getContent().addAll(otherelt.getContent())
> > 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.

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.


Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games

More information about the jdom-interest mailing list