You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sampath K Settipalli <Sa...@genome.wi.mit.edu> on 2002/08/01 19:55:19 UTC
writing a DOM DOcument to file
Hi,
Is there any thing in Xerces similar to TXDocument.toXMLString() so
that we can use the returned String to write to a File ?
All I want is write a DOM Document to a File.
Thanks in Advance,
Sampath
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: writing a DOM DOcument to file
Posted by Elena Litani <el...@ca.ibm.com>.
Sampath K Settipalli wrote:
> Is there any thing in Xerces similar to TXDocument.toXMLString() so
> that we can use the returned String to write to a File ?
You can use org.apache.xml.XMLSerializer to serialize a Document, i.e.:
XMLSerializer serializer = new XMLSerializer(System.out, new
OutputFormat(doc));
serializer.asDOMSerializer();
serializer.serialize(doc);
Also, Xerces provides implementation [1] for DOM Level 3 Load and Save
[2]. This API allows you to load and serialize document.
Note: DOM Level 3 is a Working Draft, which represents work in progress
and thus the API may be changed.
For more information see DOM3.java sample [3].
[1] http://xml.apache.org/xerces2-j/faq-write.html#faq-1
[2] http://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/
[3] http://xml.apache.org/xerces2-j/samples-dom.html#DOM3
--
Elena Litani / IBM Toronto
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org