[jdom-interest] how to append to an xml file using jdom

awais hamid hamid_awais at hotmail.com
Wed Jun 30 14:50:24 PDT 2004

Hello friends  i am deeloping a semantic cache of xml queries and xml 
Here is a glimpse of my code in which i am creating an xml document with 
following structure
- <queries>

SAXBuilder saxobj=new SAXBuilder();
Element rootofquery = new Element("queries");
Element elementofquery = new Element("query");
Document doc1ofquery = new Document();



In the code given below i will be saving xml o queries.xml file

XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
File queryfile=new File("queries.xml");
FileOutputStream queryout=new FileOutputStream(queryfile);

	    outputter.output(doc1ofquery, queryout);

But every time when this script executes the previus data is overwritten 
which i dont want.

What should be done? to append to existing data instead of replacing it.

I would be thankful for ur replies

Help STOP SPAM with the new MSN 8 and get 2 months FREE*  

More information about the jdom-interest mailing list