Extensible Markup Language (XML) is pervasive in the .NET Framework. It's used to pass messages between components and as the serialization and configuration language for .NET, among other things. As you'd expect, the .NET Framework includes a rich set of classes for working with XML.
In this chapter you learned about some of the main classes in the System.Xml namespace and associated namespaces, such as System.Xml.Schema and System.Xml.XPath. You learned how the Document Object Model (DOM) is used to represent an XML document as a tree of nodes. (Similar to many other parts of XML, DOM is an official standard of the World Wide Web Consortium, better known as the W3C.) You saw how the XmlReader class gives you forward-only, read-only access to the DOM, as well as how the XmlNode and XmlDocument objects can be used to manipulate the DOM version of an XML document.
You learned about the XmlDataDocument class, which provides two-way synchronization between an XML document and the equivalent DataSet. You saw how you could create such a synchronized hierarchical and relational view of your data by starting with either an XML document or an existing DataSet.
This chapter also introduced the basic syntax of the XPath query language, which enables you to address parts of an XML document. You learned how to use XPath in conjunction with the XPathNavigator class to select nodes of an XML document. You also learned how the XPathNavigator class provides random access to the nodes in the DOM representation of an XML document.
You explored XML schemas in a bit more depth, learning how to create a schema from an existing XML file. I also introduced the concept of XML validation and showed you how to use the XmlValidatingReader class to validate an XML document.
Finally, you learned how to use XML to communicate with a Microsoft SQL Server database. You saw the syntax of the FOR XML clause of the T-SQL SELECT statement, which allows you to extract information from a SQL Server database directly as XML. You also learned about DiffGrams and saw how to use the SQLXML managed classes to execute a DiffGram on a SQL Server database.