You should use XmlWriter
when you want to output
data from your program to a file or Stream
in XML
format. Since XmlTextWriter
’s
constructors take a Stream
, a filename, and a
TextWriter
, respectively, you can output to any
common I/O target.
In addition, any .NET class that takes an
XmlWriter
to output its data as XML may use any
XmlWriter
subclass. This means, for example, that
you may output a DOM tree in any of the supported formats. You may
also send data to any other format, as long as an
XmlWriter
exists to produce that format.
Like XmlReader
, you can extend
XmlWriter
to produce output in alternative XML
syntaxes—or even syntaxes that have nothing whatsoever to do
with XML, as long as the XmlWriter
interface is
supported.
18.220.245.140