Learn how ADO.NET not only supports relational data through the data provider, DataSet, and Adapter architecture, but also adds support for all types of nonrelational data through its integration with XML.

This chapter is from the book

This chapter is from the book

The DataSet class interoperates with XML schema and data. The
XmlDataDocument combines XmlDocument and DataSet
functionality.

7.1 XML and Traditional Data Access

The preceding chapters have talked about the data access stack mostly as it
relates to traditional data access and relational data. Each time, I've
mentioned nonrelational data (homogeneous and heterogeneous hierarchies and
semistructured data) almost as an afterthought, or to illustrate that it would
be a stretch to support it by using the classes in System.Data. But a
wide variety of data can be represented in a nonrelational way. Here are a few
examples.

Each item in the NT file system is either a directory or a file. This is
an example of a heterogeneous hierarchy. A related case is the reading of data
from an Exchange store. Not only are contacts in the Contacts folder structured
differently from mail messages in the Inbox, but also each mail message can
contain 0N attachments. The attachments can also vary in data format.
Exchangeor other IMAP (Internet Mail Access Protocol) mail
systemscan also expose hierarchical folders. All these data structures are
analogous to the multiset in IDMS.

Screen scraping from HTML or XML pages consists of reading through a
combination of text and tags and extracting only the data you needfor
example, the number in the third column of the fourth row of an HTML table and
the contents of the third <h3> tag. This is an example of
semistructured data.

There are ways to approximate each different data typewith the possible
exception of semistructured databy using a variation of a relational
concept. Sometimes, however, you need to present the data in an alternative,
nonrelational format. For example, suppose you're managing an electronic
student registration form that contains data that affects the value of 15
different normalized relational tables. In addition, the form may contain
information, such as a request for low-fat, vegetarian meals, that has no
correlation in the relational schema. You may want to store the information in
the request into multiple tables and reproduce the original request on demand.
This might require that you retain additional information or even the entire
request in its original form. It might also be nice if the information could be
transmitted in a platform-independent, universally recognized format. Enter
XML.