Vs: [jdom-interest] Merging Documents

Jason Hunter jhunter at collab.net
Mon Jul 31 00:46:39 PDT 2000


First thing, HTML mail sucks.  It sometimes doesn't get quoted right for
some reason.

Anyway, elements can only be in one place at a time.  That's because a
getParent() call has to give one answer -- can't give two.  So elements
have to be removed from one tree before added to another, or copied with
getCopy().  In your case, a quick removal of the root before adding
should work dandy.

-jh-

---


       do you mean
       docroot1.addChild(doc2.getRootElement()); ??

Nope :) The problem is that JDOM doesn't allow Elements to participate
in multiple Documents. Or that's what is seems, I really don't know..
 
" org.jdom.IllegalAddException: The element docroot2 could not be added
as a child of docroot1 because it already has an existing parent
(document root).
        at org.jdom.Element.addChild(Element.java:859) "
I have to remind once again that I don't have an access to the latest
version of JDOM because CVS doesn't work (home dir not found). Is there
a way to update
the whole source tree using the web-CVS?



More information about the jdom-interest mailing list