<br><font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">I have two XML document as listed below:</font>
<br>
<br><font size=2 face="sans-serif">1) (xmlDocA)</font>
<br>
<br><font size=2 face="sans-serif"><GLogXMLElement></font>
<br><font size=2 face="sans-serif"><Location></font>
<br><font size=2 face="sans-serif"> <TransactionCode>NP</TransactionCode></font>
<br><font size=2 face="sans-serif"> <LocationGid></font>
<br><font size=2 face="sans-serif"> <Gid></font>
<br><font size=2 face="sans-serif">
<Xid>Rockville</Xid></font>
<br><font size=2 face="sans-serif"> </Gid></font>
<br><font size=2 face="sans-serif"> </LocationGid></font>
<br><font size=2 face="sans-serif"> <Address></font>
<br><font size=2 face="sans-serif"> <AddressLines></font>
<br><font size=2 face="sans-serif">
<SequenceNumber>2442</SequenceNumber></font>
<br><font size=2 face="sans-serif">
<AddressLine>1221 E Otem Circle</AddressLine></font>
<br><font size=2 face="sans-serif"> </AddressLines></font>
<br><font size=2 face="sans-serif"> <City>Miami</City></font>
<br><font size=2 face="sans-serif"> <ProvidenceCode>FL</ProvidenceCode></font>
<br><font size=2 face="sans-serif"> <PostalCode>91991</PostalCode></font>
<br><font size=2 face="sans-serif"> </Address></font>
<br><font size=2 face="sans-serif"></Location></font>
<br><font size=2 face="sans-serif"></GLogXMLElement></font>
<br>
<br><font size=2 face="sans-serif">2) (xmlDocB)</font>
<br>
<br><font size=2 face="sans-serif"> <Transmission></font>
<br><font size=2 face="sans-serif"> <TransmissionHeader></font>
<br><font size=2 face="sans-serif">
<UserName /></font>
<br><font size=2 face="sans-serif">
<Password /></font>
<br><font size=2 face="sans-serif"> </TransmissionHeader></font>
<br><font size=2 face="sans-serif"> <TransmissionBody></font>
<br><font size=2 color=blue face="sans-serif">
<!----- here goes GLogXMLElement XML element ----></font>
<br><font size=2 face="sans-serif"> </TransmissionBody></font>
<br><font size=2 face="sans-serif"> </Transmission></font>
<br>
<br><font size=2 face="sans-serif">I want to merge document 1) in to document
2) under <TransmissionBody> element. </font>
<br>
<br><font size=2 face="sans-serif">Is it possible?</font>
<br>
<br><font size=2 face="sans-serif">When I try to do that I get </font><font size=2 color=red face="sans-serif">org.jdom.IllegalAddException:
The Content already has an existing parent</font>
<br>
<br><font size=2 face="sans-serif">Code:</font>
<br>
<br><font size=2 face="sans-serif"> SAXBuilder
saxBuilder = new SAXBuilder();</font>
<br><font size=2 face="sans-serif"> java.io.File
xmlFile = new File("xmlDocA");</font>
<br><font size=2 face="sans-serif"> org.jdom.Document
xmlDocumentA = saxBuilder.build(xmlFile);</font>
<br>
<br><font size=2 face="sans-serif"> xmlFile
= new File("xmlDocB");</font>
<br><font size=2 face="sans-serif"> org.jdom.Document
xmlDocumentB = saxBuilder.build(xmlFile);</font>
<br>
<br><font size=2 face="sans-serif"> Element
rootA = xmlDocumentA.getRootElement();</font>
<br><font size=2 face="sans-serif"> List childrenDocA
= rootA.getChildren();</font>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 face="sans-serif"> Element
rootB = xmlDocumentB.getRootElement();</font>
<br><font size=2 face="sans-serif"> Element
childDocB = rootB.getChild("TransmissionBody");</font>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 color=red face="sans-serif">
childDocB.addContent(childrenDocA);
-----------------
Exception at this line</font>
<br>
<br><font size=2 face="sans-serif"> XMLOutputter
xmlOutPutter = new XMLOutputter(Format.getPrettyFormat());</font>
<br><font size=2 face="sans-serif"> xmlOutPutter.output(xmlDocumentB,
System.out);</font>
<br>
<br><font size=2 face="sans-serif">Thanks</font>
<br><font size=2 face="sans-serif">Jasmin</font>
<br>
<br>
<br><p><font size="1"><font face="arial,helvetica,sans-serif"><strong>******************************************************************************<br /></strong><font color="#ff0000">ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION</font> <br />Our domain name is changing. Please take note of the sender's<br />e-Mail address and make changes to your personal address list,<br />if needed. Both domains will continue to work, only for a limited<br />time.<br />******************************************************************************<br />This email and any files transmitted with it are intended solely for <br />the use of the individual or agency to whom they are addressed. <br />If you have received this email in error please notify the Navy <br />Exchange Service Command e-mail administrator. This footnote <br />also confirms that this email message has been scanned for the<br />presence of computer viruses.</font></font></p><p><font size="1"><font face="arial,helvetica,sans-serif">Thank You! <br /><strong>******************************************************************************</strong></font></font></p>