[jdom-interest] Writing on a file stream element by element

NP nicola.padovano at gmail.com
Thu Oct 4 02:07:24 PDT 2007


Hi.

I have a document so:
mydoc = new Document();
a root element:
rootElement = new Element(....);
mydoc.setRootElement(rootElement);

Now i create a new element:
Element myel = new Element(.....);

addin' it to the root:
rootElement.addContent(myel);

Now i must add the new information (myel) on a file. The code that i 
wrote was:
XMLOutputter out = new XMLOutputter(....);
out.output(mydoc, new File(....));

But in this way, everytime, i write the whole document in the file 
(delete file and rewrite the updated document).
My problem, instead, is write the new element one by one, everytime that 
i create it.


More information about the jdom-interest mailing list