Mapping Schema
So, how do we get relational data from a database into an XML document format? Well, we first start with an XML schema document. This alone isn't enough, though. The schema describes the structure of the document, but there is still no relation between the document and the data yet. The additional things we need to tie these two objects together are what is referred to as annotations to the XDR schema. An annotated XDR schema is referred to as a mapping schema because it maps the schema to the relational database. This allows data to be retrieved in the form of an XML document (see Figure 1).
Figure 1 Schemas, Annotations, and XPath
There are several schema annotations defined by Microsoft that map the elements and attributes of XML data to database tables and columns. Think of a mapping schema as a database view, which is created with the CREATE VIEW command. Queries against mapping schema are carried out via XPath queries much in the same way SQL queries are used to extract data from a database view.