Writing an XML Declaration
Once the XmlTextWriter is created and initialized and the properties have been set to your liking, you can start writing XML data to the stream. The XmlTextWriter provides a rich API for writing nodes to the XML data stream. This section will look at the methods for writing the most important nodes: XML Declarations, Elements, and Attributes.
An XML declaration is not required in an XML document, but it can provide helpful information for parsers. The XmlTextWriter provides WriteStartDocument for writing the XML declaration to the XML stream. The API allows you to specify whether the document will be a standalone. Since DocumentType nodes are not supported by the .NET Compact Framework's XmlTextWriter, the document ...
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