[jdom-interest] Moving elements closer to the root

Jason Hunter jhunter at collab.net
Mon May 7 18:08:58 PDT 2001


Thomas Nichols wrote:
> 
> The exception thrown is:
> 
> org.jdom.IllegalAddException: The element "c" could not be added as a child
> of "a": The element already has an existing parent "b".
> 
> So... how do I tell child that its parent has changed? Element.setParent is
> protected, do I have to subclass and do a
> child.setParent (grandParent) ? The rest of JDOM seems pretty clean, I'm
> hoping there's a straightforward way to do this? Perhaps using getCopy() or
> clone()?

I'd ask you to attach the simplest test case you can demonstrating the
problem.  What you described should work.

> Excellent API, thanks a lot.

:-)

-jh-



More information about the jdom-interest mailing list