[jdom-interest] merging two jdom docs

Kevin Baynes kbaynes at renex.com
Thu Mar 8 10:04:42 PST 2001


I accomlished it like so:

doc = builder.build(firstFile);
doc2 = builder.build(secondFile);

Element root = doc.getRootElement();
Element root2 = doc2.getRootElement();


List children = root.getChildren();
List children2 = root2.getChildren();

children.addAll(children2);

root.removeChildren();
root.setChildren(children);

-Kevin
  -----Original Message-----
  From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of buzzonus
  Sent: Wednesday, March 07, 2001 8:50 PM
  To: jdom-interest at jdom.org
  Cc: buzzonus at yahoo.com
  Subject: [jdom-interest] merging two jdom docs


  Hi,
  Is there a way to merge two jdom documents, i.e. can one import an entire
tree from one JDOM into another ??
  I think one can do this using the importNode method in the w3c dom.

  I apologize if this has already been discussed before.

  thanks,
  Sing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010308/c94cf892/attachment.htm


More information about the jdom-interest mailing list