<br><font size=2 face="sans-serif">I am building multiple dynamic xml documents
from result set and storing them to an ArrayList called 'xmlDocumentList'.</font>
<br><font size=2 face="sans-serif">I have another static xml document called
'staticDocument'. Where static document looks like:</font>
<br>
<br><font size=2 face="sans-serif">&lt;Transmission&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &lt;TransmissionHeader&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &lt;UserName /&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &lt;Password /&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/TransmissionHeader&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &lt;TransmissionBody&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &lt;!----- here
goes GLogXMLElement XML element ----&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &lt;/TransmissionBody&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp;&lt;/Transmission&gt;</font>
<br>
<br><font size=2 face="sans-serif">Now I want to create another ArrayList
'finalDocumentList' out of mergeing 'staticDocument' with each element
of 'xmlDocumentList'. That will be like each element of 'finalDocumentList'
is made from merging 'staticDocument' with 'xmlDocumentList[i]' (one of
dynamic document element) at &lt;TransmissionBody&gt;. When I do that with
attached code snippet, it creates the GlogFinal0.xml, GlogFinal1, GlogFinal2..etc
file with all having same content in them. It uses only first element of
'xmlDocumentList' to build all elements of 'finalDocumentList'.</font>
<br>
<br><font size=2 face="sans-serif">----------------------------------------------------------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ArrayList
dynamicDocumentList = xmlBuilder.getDynamicXmlDocuments();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Document
staticDocument = xmlBuilder.getStaticXmlWrapper();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ArrayList
finalDocumentList = new ArrayList(); </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Element
staticRoot = staticDocument.getRootElement();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Element
staticChild = staticRoot.getChild(&quot;TransmissionBody&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Element
dynamicRoot = null;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; for(int
i = 0; i &lt; dynamicDocumentList.size(); i++)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
dynamicRoot = ((Document)dynamicDocumentList.get(i)).getRootElement();</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
staticChild.addContent(dynamicRoot.detach()); </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;finalDocumentList.add(staticDocument);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileOutputStream
finalXmlFile = null;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XMLOutputter
xmlOutPutter = null;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for
(int i = 0; i &lt; finalDocumentList.size(); i++)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
finalXmlFile = &nbsp;new FileOutputStream(&quot;F:\\JavaProjects\\WorkspaceDev\\OTM\\xsl\\GLogFinal&quot;+i+&quot;.xml&quot;);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
xmlOutPutter = new XMLOutputter(Format.getPrettyFormat());</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
xmlOutPutter.output((Document)(finalDocumentList.get(i)), finalXmlFile);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp;</font><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>