The .NET Framework XML Implementations


The .NET Framework class library provides two ways of processing XML data:

  • Fast, noncached, forward-only stream

  • Random access via an in-memory Document Object Model (DOM) tree

Both methods of processing XML data are equally valid. However, each has a definite time when it is better suited. At other times, both will work equally well, and the decision of which to use is up to the developer's taste.

The major deciding factors for choosing one method over the other are whether all data needs to be in memory at one time (large files take up large amounts of memory, which in many cases isn't a good thing) and whether random access to the data is needed. When either of these factors occurs, the DOM tree should probably be used because the process of repeatedly reading forward sequentially through a document to find the right place in the stream of XML to read, update, or write random data is time consuming.

On the other hand, if the data can be processed sequentially, a forward-only stream is probably the better choice because it is easier to develop and uses fewer resources more efficiently than a DOM tree. However, there is nothing stopping you from using a DOM tree in this scenario as well.

Implementing XML with the .NET Framework class library requires referencing the System.Xml.dll assembly. You would think that due to the heavy reliance on XML in the .NET Framework, it would be part of the mscorlib.dll assembly. Because it is not, your source code implementing XML requires the following code be placed at the top of your source code (this is done automatically for you by Visual Studio .NET for Windows Forms applications but not for console applications):

 #using <system.xml.dll> 

Five namespaces house all of the XML functionality within the .NET Framework class library. Table 13-1 describes these namespaces at a high level.

Table 13-1: XML Namespaces

NAMESPACE

DESCRIPTION

System::Xml

Provides the core of all XML functionality

System::Xml::Schema

Provides support for XML Schema definition language (XSD) schemas

System::Xml::Serialization

Provides support for serializing objects into XML formatted documents or streams

System::Xml::XPath

Provides support for the XPath parser and evaluation engine

System::Xml::Xsl

Provides support for Extensible Stylesheet Language Transformations (XSLT) transforms




Managed C++ and. NET Development
Managed C++ and .NET Development: Visual Studio .NET 2003 Edition
ISBN: 1590590333
EAN: 2147483647
Year: 2005
Pages: 169

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