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 ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.