xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey Rodriguez" <jeffreyr...@hotmail.com>
Subject Re: writing the dom into the file
Date Wed, 18 Apr 2001 23:52:12 GMT
Hi Kate,

Something like this ought (using the serializer) to work:

Given a parsed doc:

Here doc is just any class that implements org.w3c.dom.Document interface.



OutputFormat    format    = new OutputFormat( doc );   //Serialize DOM
FileWrite      outWriter  = new FileWriter( "test.xml" );

XMLSerializer    serial = new XMLSerializer( outWriter, format );
serial.asDOMSerializer();     // As a DOM Serializer
serial.serialize( doc.getDocumentElement() );
outWriter.toString();


Thanks,

                            Jeffrey Rodriguez



>From: Kate Lapan <kate@Peakstone.com>
>Reply-To: general@xml.apache.org
>To: general@xml.apache.org
>Subject: writing the dom into the file
>Date: Wed, 18 Apr 2001 15:34:32 -0700
>
>I'm converting my code from jaxp and crimson to xerces.
>
>How do I write the document into a file?
>
>Before it was done:
>
>doc.write(outWriter);
>
>where doc is org.apache.crimson.tree.XmlDocument
>
>Thanks for your help,
>
>Kate
>
>---------------------------------------------------------------------
>In case of troubles, e-mail:     webmaster@xml.apache.org
>To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
>For additional commands, e-mail: general-help@xml.apache.org
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message