XmlWriter and Its Subclasses
XmlWriter
is an abstract base class
that defines the interface for creating XML output programmatically.
It contains methods such as WriteStartElement( )
and WriteEndElement( ) to write data.
XmlWriter maintains the state of the XML document
as it writes, so it knows which start element or attribute to close
when you call WriteEndElement( ) or
WriteEndAttribute( ).
XmlTextWriter
is the subclass of
XmlWriter, which provides support for output of
XML to any Stream, filename, or
TextWriter. In addition to all the required
features of an XmlWriter,
XmlTextWriter allows you to set the formatting of
the output, using the Formatting,
Indentation, IndentChar,
Namespaces, and QuoteChar
properties.
The XmlTextWriter formatting properties are
described in Table 3-6.
|
Property |
Type |
Description |
Formatting |
System.Xml.Formatting |
Specify |
Indentation |
int |
If |
IndentChar |
char |
If |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access