Design Goals for XML in the .NET Framework
The goals of XML in .NET Framework are:
Compliance with the W3C standards.
Tight integration with ADO.NET.
Standards compliance means that the classes fully conform to the current W3C recommended standards of XML, Namespaces, XSLT, XPath, Schema, and the Document Object Model (DOM). Compliance ensures interoperability and eases application development across platforms.
Most notably, the XML classes in .NET Framework supports the W3C XML Schema Definition language (XSD) 1.0 recommendation. There are XML classes in the .NET Framework that provide validation, and an object model is available to build the XSD Schemas in memory. The fast, forward-only parser that can validate against XML Schemas and DTDs is called the. The XmlReader is a compliant XML parser. The class can be use to cache frequently used XML Schemas.
There are a set of XML classes in the .NET Framework that provide a Schema Object Model (SOM) that allows you to programmatically build and compile XSD schemas. Theclass represents an XSD schema. These schemas can be loaded and persisted using the XmlReader and classes.
Theclass implements the Document Object Model level 1 and level 2 recommendations and is tailored to the common design guidelines of the .NET Framework. For example, the method names are capitalized.
Theclass conforms to the XSL Transformations (XSLT) Version 1.0 recommendation and the XML Path Language (XPath) 1.0 recommendation for transforming documents using XSLT.
The XML classes in the .NET Framework are designed to be extensible through the use of abstract base classes and virtual methods. This extensibility is illustrated by theclass. The XmlResolver class is an abstract class that resolves XML resources such as entities, import or export elements, and so on. The and classes are implementations of the XmlResolver class. You can create a customized version of the XmlResolver class by deriving from the XmlResolver class or any of its implementations. For example, you could decide to create a derived class of the XmlUrlResolver class that stores the cache stream to the local disk.
XML in the .NET Framework has a pluggable architecture. Pluggable, in this stream-based architecture, means that components that are based on these abstract classes within the .NET Framework can be easily substituted. Pluggable architecture also means that data can be streamed between the components, and new components inserted into this stream can alter the processing. For example, a stream of XML from an XML Web service can be parsed with the XmlReader. The XmlReader can be used to create an XmlDocument, which in turn can be used to create an.
Another example is loading the DOM (XmlDocument class) from an XmlReader and saving the output using an XmlWriter.
You can also create your own implementation of the XmlReader class and load that into the XmlDocument class. For example, you can derive a new class from the base XmlReader class, and customize it to expose a file system as XML. This new customized XmlReader implementation can then be loaded into an XmlDocument. This provides a pluggable architecture for new classes based on existing ones.
Another example of plugging components together is the use of different data stores, such as anor an XmlDocument, in the transformation process. These data stores can be transformed with the XslCompiledTransform class and the output can then be streamed either into another store or returned as a stream from an XML Web service.
The XML classes in the .NET Framework represent low-level XML processing components that are used, not only as part of the .NET Framework, but to integrate XML into applications.
The XML classes in the .NET Framework are designed to support a streaming-based model by having the following characteristics:
Minimal caching for forward-only, pull model parsing with the XmlReader.
Forward-only validation with the XmlReader.
Innovative cursor style navigation of the, which minimizes node creation to a single virtual node, yet provides random access to the document. This does not require a complete node tree to be built in memory like the DOM.
The XPathDocument is an optimized, read-only store for XPath queries and is recommended whenever XSLT processing is required. By using this store and the XslCompiledTransform class faster XSLT transformations can be achieved.
Integration with ADO.NET
Relational data and XML are brought together in the .NET Framework by a tight integration between the XML classes and ADO.NET.
Theclass is an in-memory cache of data retrieved from a database. The DataSet has the ability to read and write XML using the XmlReader and XmlWriter classes, persist its internal relational schema structure as XML Schemas (XSD), and the ability to surmise the schema structure of an XML document.