[jdom-interest] saving document as a file

Matthew Cooper and Clare James overhere at bigpond.com
Sat Jun 3 16:49:43 PDT 2000

with something like...

      FileOutputStream fileOutputStream = new
      XMLOutputter outputter = new XMLOutputter();
      outputter.output(document, fileOutputStream);

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Dan Olson
Sent: Sunday, 4 June 2000 8:05 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] saving document as a file

Okay, so I've got an xml file; as per the example in the article, I convert
that into a Document object, which I can then read, modify, etc.  How do I
convert the modified Document back into a file?  Am I missing something

      File xmlFile = new File("exampleFile.xml");

      // Build the document with SAX and Xerces, validation if true
      SAXBuilder builder = new SAXBuilder(true);

      // Create the document
      Document document = builder.build(xmlFile);

      // do stuff with the document
      // save the modifed document as a file (how?)

To control your jdom-interest membership:

More information about the jdom-interest mailing list