Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

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

NP

2007-10-04

Replies:

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.
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.