[jdom-interest] saving document as a file

Dan Olson dgolson at mines.edu
Sat Jun 3 15:05:20 PDT 2000


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?)





More information about the jdom-interest mailing list