[jdom-interest] Merging jdoms

Heather Boyd hlb at aspectgroup.co.uk
Tue May 8 06:10:34 PDT 2001

I have three small jdoms (all different) and would like to create a new jdom
from them, but keep them intact.
In otherwords the old jdoms are copied exactly, and their root Element is
added to the root Element
of the new jdom.

Is there an easy way to do this, ie, I though something like this would work
but it

Document doc = new Document(new Element ("NEW"));
Element root = doc.getRootElement();

Document doca =  JDomFromAnOtherSource()
Element a = doc.getRootElement();

Document docb =  JDomFromAnOtherSource()
Element b = doc.getRootElement();

Document docc =  JDomFromAnOtherSource()
Element c = doc.getRootElement();

Also this would only add a the root Element and not the rest of the tree.
But is there anything 
along these lines or to I have to traverse each tree individually and add it
to the new master parent jdom.

Many thanks
Heather Boyd

More information about the jdom-interest mailing list