20.5 Summary
The following summarizes the .NET Framework XML classes:
The .NET Framework has built-in support for XML processing, something Java was lacking until Java version 1.4.
The .NET classes support both the DOM and the SAX APIs.
Unlike the Java SAX parsers, which process every tag of an XML document, the .NET SAX parser uses the flexible pull model to extract data and parses only those tags in which you are interested. You can skip sections of the documents while parsing.
The Java SAX parser uses the event programming paradigm; therefore, the state of the parsing process is maintained by a set of classes. The .NET SAX parser allows for simple while loop constructs for conditional parsing of the XML document.
You can read and write XML to any stream (file, memory) by us-_ing the subclasses of System.Xml.XmlReader and System.Xml_.XmlWriter. The key subclasses of XmlReader are XmlTextReader, XmlValidatingReader, and XmlNodeReader. The key subclass of XmlWriter is XmlTextWriter.
The .NET DOM implementation supports all of DOM Level 1 and all of DOM Level 2 Core. The DOM tree is read and written through classes built on top of XmlNodeReader and XmlNodeWriter. The .NET DOM API is similar to the third-party JDOM API of Java (http://www.jdom.org).
The .NET Framework has built-in classes for evaluating and running XPath expressions and doing XSLT transformations.