Support for processing XML is provided by the classes in the System.Xml namespace in .NET. This section looks (in no particular order) at some of the more important classes that the System.Xml namespace provides. The following table lists the main XML reader and writer classes.
Class Name | Description |
---|---|
XmlReader | An abstract reader class that provides fast, noncached XML data. XmlReader is forward-only, like the SAX parser. |
XmlWriter | An abstract writer class that provides fast, noncached XML data in stream or file format. |
XmlTextReader | Extends XmlReader. Provides fast forward-only stream access to XML data. |
XmlTextWriter | Extends XmlWriter. Fast forward-only generation of XML streams. |
The following table lists some other useful classes for handling XML.
Class Name | Description |
---|---|
XmlNode | An abstract class that represents a single node in an XML document. Base class for several classes in the XML namespace. |
XmlDocument | Extends XmlNode. This is the W3C DOM implementation. It provides a tree representation in memory of an XML document, enabling navigation and editing. |
XmlDataDocument | Extends XmlDocument. This is a document that can be loaded from XML data or from relational data in an ADO.NET DataSet. Allows the mixing of XML and relational data in the same view. |
XmlResolver | An abstract class that resolves external XML-based resources such as DTD and schema references. Also used to process <xsl:include> and <xsl:import> elements. |
XmlNodeList | A list of XmlNodes that can iterated through. |
XmlUrlResolver | Extends XmlResolver. Resolves external resources named by a uniform resource identifier (URI). |
Many of the classes in the System.Xml namespace provide a means to manage XML documents and streams, whereas others (such as the XmlDataDocument class) provide a bridge between XML data stores and the relational data stored in DataSets.
Important | It is worth noting that the XML namespace is available to any language that is part of the .NET family. This means that all of the examples in this chapter could also be written in Visual Basic .NET, managed C++, and so on. |