View Single Post
  #2 (permalink)  
Old 03-27-2008, 04:59 PM
DonCash's Avatar
DonCash DonCash is offline
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
Hey,

Try this to write the file back out as .xml
Firstly add this bit of code just above the DOM parse.

Code:
Writer output = null; output = new BufferedWriter(new FileWriter("docname.xml")); String newline = System.getProperty("line.separator");
To write to the file you need to add the code below. I haven't had a chance to play with your example yet so you will need to experiment with the placement of this code to make it work correctly.

Code:
output.write("whatever text to be printed out"); output.write(newline);
And at the end of the code make sure you add:

Code:
output.close();
Otherwise nothing will be written to the file.

I hope this helps!
Reply With Quote