.NET XML Architecture

.NET contains an entire XML Framework. This Framework comprises a number of classes that make it easy for you to implement and work with XML in your applications. Because .NET is so reliant on XML, Microsoft spent a great deal of time making these classes robust, easy to use, and very performant (i.e., it performs well in terms of CPU and execution time). As I have said before, these classes all follow the W3C specification for XML, and they are an evolution to MSXML, which you may have already used.

Much of .NET actually uses XML for its native data representation. Examples of this can be seen in ASP.NET and Web Services (which rely on SOAP), and you can even see XML in the automatic source-code comments that are added when you create classes with Visual Studio .NET. XML is also an integral part of ADO.NET and SQL Server 2000.

The .NET XML classes enable you to easily work with relational data and hierarchical data. The classes provide a unified programming model.

NOTE: The .NET XML Framework can be found in several namespaces. The core types are contained in System.Xml. The XPath and Xslt types can be found in System.Xml.XPath and System.Xml.Xsl. Another important namespace is System.Xml.Serialization. To use these classes, you must import the correct namespaces through the using directive, as follows:

 using System.Xml; using System.Xml.Xpath; using System.Xml.Xsl; using System.Xml.Serialization; 


At the core of the .NET Framework XML classes are two abstract classes: XmlReader and XmlWriter. XmlReader provides a fast, forward-only, read-only cursor for processing an XML document stream. XmlWriter provides an interface for producing XML document streams that conform to the W3C's XML recommendations. Applications that need to process XML documents use XmlReader, whereas applications that want to create XML documents use XmlWriter. Both classes imply a streaming model that doesn't require an expensive in-memory cache. This makes them both attractive alternatives to the classic DOM approach.

The XmlReader and XmlWriter classes are abstract base classes. They define functionality that all derived classes must support. At present, three implementations of XmlReader are included in the .NET Framework: XmlTextReader, XmlNodeReader, and XslReader. The implementation of XmlWriter is in the .NET Framework. It is XmlTextWriter. The XmlTextReader and XmlTextWriter classes support reading from and writing to text-based streams. XmlNodeReader is used for in-memory DOM trees. One of the biggest advantages of this design is that custom readers and writers can be developed to extend the built-in functionality. I expect to see many of these extended classes appear on the Internet and in newsgroups as developers extend the classes to meet their needs and share the classes with others.



ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
EAN: N/A
Year: 2003
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net