Title: RE: What is the best way to write a XML file?

You can do it with this function:

// This method writes a DOM document to a file
    public static void writeXmlFile(Document doc, String filename) {

      try {
        // Prepare the DOM document for writing
        Source source = new DOMSource(doc);

        // Prepare the output file
        File file = new File(filename);
        Result result = new StreamResult(file);

        // Write the DOM document to the file
        Transformer xformer = TransformerFactory.newInstance().newTransformer();
        xformer.transform(source, result);
      } catch (TransformerConfigurationException e) {
      } catch (TransformerException e) {
      }
    }



----------------------------
Jo�o Moita
PayCenter

e-mail   :[EMAIL PROTECTED]
Telem.   : +351.916.610.721
Telef.   : +351.218.394.860
Fax      : +351.218.394.868

www.eb-focus.pt



-----Original Message-----
From: Marcial Atienzar Navarro [mailto:[EMAIL PROTECTED]]
Sent: quinta-feira, 13 de Junho de 2002 20:05
To: [EMAIL PROTECTED]
Subject: What is the best way to write a XML file?


Hello another time,

        I've a document from a XML file, and I want to modify some
fields of the document and finally save it to the same file?

        Have I to make all the xml file or is there a class to do it
easily?.

        Thanks,

                Marcial




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to