Chapter 11 - Manipulating XML | |
bySimon Robinsonet al. | |
Wrox Press 2002 | |
Support for processing XML is provided by the classes in the System.Xml namespace in .NET. Let's take a look (in no particular order) at some of the more important classes that the System.Xml namespace has for us to use. Here are the main XML reader and writer classes that we will be discussing:
Class Name | Description |
---|---|
XmlReader | An abstract reader class that provides fast, non-cached XML data. XmlReader is forward only, like the SAX parser. |
XmlWriter | An abstract writer class that provides fast, non-cached 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. |
Some other useful classes for handling XML include the following:
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 Document Object Model (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. |
XmlUrlResolver | Extends XmlResolver . Resolves external resources named by a URI (Uniform Resource Identifier). |
Many of the classes in the System.Xml namespace provide a means to manage XML documents and streams, while others (for example the XmlDataDocument class) provide a bridge between XML data stores and the relational data stored in DataSet s.
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 VB.NET, Managed C++, and so on. |