17.3 Other .NET XML Classes

The .NET framework provides a full complement of classes for XML manipulation, which are found in the System.Xml family of namespaces (see Table 17-5).

Table 17-5. XML classes in .NET

Class

Description

 XmlDocument 

An in-memory representation of an XML document. You can navigate freely through its structure, adding, removing, inserting, or modifying nodes.

 XmlSchema 

An in-memory representation of an XML schema document.

XmlTextReader and XmlTextWriter

Allows you to quickly retrieve XML data from or save it to a file or stream. These classes provide optimized forward-only access.

 XmlValidatingReader 

Similar to XmlReader in that it provides read-only, forward-only access to an XML file or a stream. Unlike XmlReader , XmlValidatingReader throws an exception if the XML document violates the rules in a specified schema.

 XslTransform 

Allows you to perform XSLT transformations to change an in-memory XML document to another XML document.

These classes offer XML-specific functionality that isn't directly available through the ADO.NET objects. For example, if you load a serialized DataSet using an XML file and XSD schema, you may not receive a warning if the XML document violates the schema; typically, you'll just lose some of the data. In cases in which you aren't sure if the XML file fits a given schema (or, in other words, you aren't sure that the data in an XML file pertains to a given table or a given version of that table), you can run through the XML file with the XmlValidatingReader before loading it into the DataSet .



ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

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