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 (Second Edition) (www.w3.org/TR/2000/REC-xml-20001006.html) recommendation and the Namespaces in XML recommendation (www.w3.org/TR/REC-xml-names/).
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.
In This Section
- New Features in the XmlWriter Class
-
Describes changes to the XmlWriter class.
- Using the XmlWriter
-
Describes how to create XmlWriter objects, write typed data, and other common XmlWriter usage.