Reading and Writing XML in .NET Version 2.0 - Part 1
It must be tough for companies that develop software for working with XML. No sooner do they get a product out of the door, the World Wide Web Consortium (W3C) changes the recommendations and standards so that their product is out of date. Yet the manufacturers still have to maintain backward compatibility with their previous releases, while attempting to encompass all the new standards. We’ve seen this several times before in Microsoft’s XML product space, and the process shows little sign of stabilizing yet.
OK, so the base specification for XML itself, version 1.0, is complete, stable and implemented in almost all products now. But recent advances in technologies such as XML Query Language (XQuery - see http://www.w3.org/XML/Query) and the XML Information Set (XML InfoSet - see http://www.w3.org/TR/xml-infoset/) require changes to core classes in the System.Xml namespace with each release of the Framework, to keep up with evolving standards.
When version 1.0 of the .NET Framework was introduced, it brought with it a whole raft of new techniques for working with XML. This included a new pull-model parser, the XmlReader, new XML document objects such as XmlDocument, XmlDataDocument and XPathDocument, new classes for working with schemas, and a brand new XSL-T processor. Now, at the time of writing, version 2.0 has just appeared (this article is based on the Beta 2 release). And after the preamble above, you won’t be surprised to learn that there are a great many changes in the release compared to version 1.x.
In this series of three articles, we’ll look in detail at how the new features of the XmlReader and XmlWriter classes in version 2.0 of the .NET Framework can be used to read and write XML documents, and interact with the new XML document store objects. This includes:
The new “settings” classes and static Create methods for XmlReader and XmlWriter
Creating and using an XmlReader to read and validate XML documents and fragments
Two of the useful new features of the XmlReader class
Creating and using an XmlWriter to write XML documents and fragments
Some useful new features of the XmlWriter class
How the XmlReader and XmlWriter can be used with the XmlDocument class
Some of the useful new features of the XmlDocument class
Along the way, we’ll look into the issues involved in using the new classes, the reasoning behind the changes, and how the new features simplify your code and provide better overall efficiency for your applications. This first article concentrates on the XmlReader class, and how the new XmlReaderSettings class makes it easy to create XmlReader instances with specific properties such as validation and access control for use in your applications.
Full article
http://www.daveandal.net/articles/readwritexml/html/Read-Write-XML-Part1.htm