Using Annotations in XSD Schemas (SQLXML 4.0)

In Microsoft SQLXML 4.0, the XSD schema language supports annotations in a manner similar to the annotations introduced in the XML-Data Reduced (XDR) schema language. There are additional annotations introduced in XSD that are not supported in XDR.

These annotations can be used within the XSD schema to specify XML-to-relational mapping. This includes mapping between elements and attributes in the XSD schema to tables (views) and columns in the databases.

If you do not specify the annotations, default mapping takes place. By default, an XSD element with a complex type maps to a table (view) name in the specified database, and an element or attribute with a simple type maps to the column with the same name as the element or attribute.

These annotations can also be used to specify the hierarchical relationships in XML—thus representing the relationships in the database, because an XSD schema is simply an XML view of relational data.

This section provides descriptions of the annotations you can use with XSD schemas and examples of their usage.

Note

All the examples in this section specify simple XPath queries against the annotated XSD schema described in each example. Familiarity with the XPath language is assumed.

In This Section