[jdom-interest] Merging jdoms
Jason Hunter
jhunter at acm.org
Tue May 8 11:06:36 PDT 2001
Heather Boyd wrote:
>
> 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
> didn't.
>
> Document doc = new Document(new Element ("NEW"));
> Element root = doc.getRootElement();
>
> Document doca = JDomFromAnOtherSource()
> Element a = doc.getRootElement();
> root.addContent(a)
Call a.detach() to remove "a" from its document before adding it to
another document.
-jh-
More information about the jdom-interest
mailing list