This question is very similar to the one on adding existing JDOM/DOM elements to a document object. I just want to know if it is possible to combine two existing XML documents together into a new JDOM object (i.e. a new XML file).

Roseanne Zhang

If you are using JDOM, then use the org.jdom.Element.clone() method. It is a deep clone, and the clone will forget where it from.

However, if you're using DOM, clone will not work, even you set it deep. You need to use org.w3.dom.Document.importNode() to do the same.

That was why I used full qualified class names.