O'Reilly logo

Microsoft® .NET Compact Framework (Core Reference) by Mark Sutton, Rory MacLoed, Robert Burbidge, Stephen Wheelwright, Andy Wigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing XML with the XmlWriter Class

The XmlWriter class is an abstract class that provides fast, forward-only, noncached output of XML to a file or a stream. You can use the XmlTextWriter class, which derives from XmlWriter, to create and persist XML documents. The advantages of using an XmlTextWriter object over performing output manually using Stream.Write calls or similar are threefold. First, XmlTextWriter will write syntactically correct XML output. Second, XmlTextWriter has powerful support for namespaces, avoiding the need for the user to maintain namespace stacks in a complex document. Third, XmlTextWriter will automatically translate any special characters in text to entities, for example, transforming x < y to x &lt; y.

In this section, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required