Partilhar via


Serializing XML Trees

Serializing an XML tree means generating XML from the XML tree. You can serialize to a file, to a concrete implementation of the TextWriter class, or to a concrete implementation of an XmlWriter.

You can control various aspects of serialization. For example, you can control whether to indent the serialized XML, and whether to write an XML declaration.

In This Section

Topic Description

Preserving White Space While Serializing

Describes how to control white space behavior when you serialize XML trees.

Serializing with an XML Declaration

Describes how to serialize an XML tree that includes an XML declaration.

Serializing to Files, TextWriters, and XmlWriters

Describes how to serialize a document to a File, a TextWriter, or an XmlWriter.

Serializing to an XmlReader (Invoking XSLT)

Describes how to create a XmlReader that enables another module to read the contents of an XML tree.

See Also

Concepts

Programming Guide (LINQ to XML)