Writing XML with the XmlWriter
The XmlWriter class is an abstract base class that provides a forward-only, write-only, non-cached way of generating XML streams. It can be used to build XML documents that conform to the W3C Extensible Markup Language (XML) 1.0 (fourth edition) recommendation and the Namespaces in XML recommendation.
The XmlWriter enables you to:
Verify that the characters are legal XML characters and that element and attribute names are valid XML names.
Verify that the XML document is well-formed.
Encode binary bytes as Base64, or BinHex, and write out the resulting text.
Pass values using common language runtime types rather than strings. This allows avoid having to manually perform value conversions.
Write multiple documents to one output stream.
Write valid names, qualified names, and name tokens.