Chapter 8. Working with XML

Introduction

ADO.NET and XML classes are tightly integrated in the .NET Framework. The DataSet can be filled with data or a schema from an XML stream or document. The DataSet can persist or serialize its data or schema to an XML stream or document. ADO synchronizes the DataSet with an XmlDataDocument. Data can be modified simultaneously using either class as needed; all changes made in one class are immediately reflected in the other class. This chapter focuses on XML support in ADO.NET and in SQL Server 2000.

The XML support in .NET is provided by integrated classes in five namespaces:

System.Xml

Contains classes that provide standards-based support for processing XML

System.Xml.Schema

Contains classes that provide standards-based support for XML Schema Definition (XSD) language schemas

System.Xml.Serialization

Contains classes that serialize objects into XML documents or streams

System.Xml.XPath

Contains classes that parse and evaluate XPath

System.Xml.Xsl

Contains classes that support Extensible Stylesheet Language (XSL) transformations

The DiffGram is an XML format that identifies current and original versions of data allowing the contents of a DataSet to be recreated accurately. The DiffGram allows you to identify the changes made to a DataSet since it was filled. The DataSet uses the DiffGram format to persist and to serialize its contents for transport across a network. Recipe 8.8 shows how to create a DiffGram of changes made to a DataSet.

SQL Server 2000 introduced ...

Get ADO.NET Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.