[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
FileOutputStream("filename.xml");
      XMLOutputter outputter = new XMLOutputter();
      outputter.output(document, fileOutputStream);
      fileOutputStream.close();

Matty
-----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
obvious?

      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:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list