Working with the XmlTextWriter
The XmlTextWriter provides a forward-only, read-only, noncached way of generating XML streams. The XmlTextWriter helps you create well-formed XML documents that conform to the W3C XML 1.0 recommendation and the namespaces in XML recommendation. The XmlTextWriter holds very little in memory other than the text to write to the file. It does, however, keep a stack of objects that represent the tags that have been written to the XML stream. The objects on the stack are used to resolve namespace prefixes and to close elements and attributes automatically, as well as to help ensure well-formedness of the document.
What Is Not Supported?
Just like with the XmlTextReader, document type nodes are not supported by the .NET ...