<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4207.2601" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>I've written a class
that extends Document. In that class, I have a function called
"createXMLFile", which basically takes a path, creates an XML file from the
extended document. However, the main document has 2 root
nodes.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>So, my code looks
something like this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>public class
ProductXMLDocument extends Document {</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000> public
ProductXMLDocument() {</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
super (new Element("root"));</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
elemCatalog = new Element("catalog");</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
this.setRootElement(elemCatalog);</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000> public void
createXMLFile(String _filePath) throws JDOMException, IOException
{</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
FileOutputStream fos = new FileOutputStream(new File(_filePath,
"products.xml"));</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
XMLOutputter xmlOut = new XMLOutputter();</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
xmlOut.output(this, fos);</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
fos.close(); // Is this necessary?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>
}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000>}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=860414316-12092000>When I look at the
file, It adds the catalog node, then all of the products, then another catalog
node, then all of the products again. Has anyone seen this before?
I've tried taking the createXMLFile code out of the ProductXMLDocument and put
it in the code that calls it, but it yields the same
results.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=860414316-12092000>Thanks.</SPAN></FONT></DIV>
<P><FONT face="Comic Sans MS"
size=2>/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\<BR>Michael
Blanton<BR>Architect<BR>CyberSource Professional Services<BR></FONT><A
href="http://www.cybersource.com/"><FONT face="Comic Sans MS"
size=2>www.cybersource.com</FONT></A><FONT face="Comic Sans MS"><FONT size=2>
</FONT><BR></FONT><A href="mailto:mikeb@cybersource.com"><FONT
face="Comic Sans MS" size=2>mikeb@cybersource.com</FONT></A><BR><FONT
face="Comic Sans MS" size=2>(408) 359-2232</FONT></P>
<DIV> </DIV></BODY></HTML>