hello all, i have a JDOM Document. i would like to add the content of this document's root element to the root element of another document. here is my attempt:
Exception in thread "main" org.jdom.IllegalAddException: The Content already has an existing parent "elem"
how can i do this? thank you!
Joined: Mar 06, 2007
Hi, I had faced a similar issue when i was working with JDOM, and i tried working with the detach() method, but was unsuccessful.The following approach will solve your problem i also found another solution:
// get content of root element List content = doc1.getRootElement().cloneContent();
cloneContent() instead of getContent() does it. you don't have to detach then.