This appendix summarizes useful XML topics and techniques.
The following table lists five special characters defined for use in XML files.
You can also include special characters inside CDATA sections. A CDATA section begins with
<![CDATA[ and includes all the following text until it reaches the closing sequence
]]>. The CDATA can include carriage returns, ampersands, quotes, and other special characters.
The .NET Framework provides two main ways to write XML data: the
XmlWriter class and the XML Document Object Model. The following two sections describe these approaches.
XmlWriter class provides methods for writing the pieces of an XML file. To use an
XmlWriter to write XML data into a file, call the class’s
Create method to create the file. Then use the other methods to write the pieces of the XML document into the file.
The following table lists the most useful
|Closes the writer’s underlying stream.|
|Creates an |
|Frees the writer’s resources. (You can use the |
|Flushes output to the underlying stream.|
|Writes an attribute with a specified name and value.|
|Writes a comment.|
|Writes an element with a specified name ...|