[jdom-interest] Divorcing Root Element from document!!

bob mcwhirter bob at werken.com
Tue Nov 7 13:31:49 PST 2000


> I am trying to take the root element of one Document and append it as a 
> child element on a second document... I continually get errors about it 
> having a parent.  How do you divorce the root element from the Document?

Set the source Document's RootElement to null, methinks, after
you've suck out the RootElement that needs transplanting.

	Element root = doc.getRootElement();
	doc.setRootElement(null);

	// can now reparent root

 -bob




More information about the jdom-interest mailing list