You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Sebastien Ponce <se...@cern.ch> on 2001/01/09 15:51:29 UTC

Re: Write DOM in a File

      // creates an output stream for the given file
      OutputStream outputStream = new FileOutputStream(new
File("myfilename.myfileextension));
      // document is supposed to be your DOM Document, creates an output format
      OutputFormat outputFormat = new OutputFormat(document);
      outputFormat.setPreserveSpace(false);
      outputFormat.setIndenting(true);
      outputFormat.setLineWidth(0);
      // creates a serializer
      serializer = new XMLSerializer(outputStream, outputFormat);
      // serializes the document
      serializer.serialize(document);

Seb

Jean-Charles DUFOUR wrote:

> Quelqu'un parmi vous pourrait-il me donner le bout de code qu'il faut écrire
> pour sauver un Document DOM dans un fichier xml.
> Merci beaucoup pour votre aide
>
> Hello, I am a beginner with Xerces and not very comfortable with Java...
> Could you help me and give me a code needed to save a Document DOM in a file
> xml.
>
> Thank you very much for your help
>
>
> ______________________________________________________________________________
> ifrance.com, l'email gratuit le plus complet de l'Internet !
> vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
> http://www.ifrance.com/_reloc/email.emailif
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org