Annotations to the XDR Schema

XML and Internet Support

XML and Internet Support

Annotations to the XDR Schema

Microsoft® SQL Server™ 2000 introduces a number of annotations to the XDR schema language. These annotations can be used within the XDR schema to specify XML-to-relational mapping. This includes mapping between elements and attributes in the XDR schema to tables/views and columns in the databases. By default, an element name in an annotated schema maps to a table (view) name in the specified database and the attribute name maps to the column name. These annotations can also be used to specify the hierarchical relationships in XML (thus, representing the relationships in the database).

The table shows the list of annotations.

Annotation Description Topic link
sql:relation Maps an XML item to the database table. Using sql:relation
sql:field Maps an XML item and the database column. Using sql:field
sql:is-constant Creates an XML element that does not map to any table. The element appears in the query output. Creating Constant Elements Using sql:is-constant
sql:map-field Allows schema items to be excluded from the result. Excluding Schema Elements from the Resulting XML Document Using sql:map-field
<sql:relationship> Specifies relationships between XML elements. The key, key-relation, foreign-key and foreign-relation attributes are used to establish the relationship. Specifying Relationships Using <sql:relationship>
sql:limit-field
sql:limit-value
Allows limiting the values returned based on a limiting value. Filtering Values Using sql:limit-field and sql:limit-value
sql:key-fields Allows specification of column(s) that uniquely identify the rows in a table. Identifying Key Columns Using sql:key-fields
sql:target-namespace Allows placing the elements and attributes from the default namespace into a different namespace for query results. Specifying a Target Namespace Using sql:target-namespace
sql:id-prefix Creates valid XML ID, IDREF, and IDREFS. Prepends the values of ID, IDREF, and IDREFS with a string. Creating Valid ID, IDREF, and IDREFS Type Attributes Using sql:id-prefix
sql:use-cdata Allows specifying CDATA sections to be used for certain elements in the XML document. Creating CDATA Sections Using sql:use-cdata
sql:url-encode When XML element/attribute is mapped to a SQL Server BLOB column, allows requesting a reference (URI) to be returned that can be used later for BLOB data. Requesting URL References to BLOB Data Using sql:url-encode
sql:overflow-field Identifies the database column that contains the overflow data. Retrieving Unconsumed Data Using sql:overflow-field

Note  All of the examples presented in the topics in this section specify simple XPath queries against the annotated XDR schema described in each example. Prior familiarity with XPath language is assumed. For more information, see Using XPath Queries.

See Also

IIS Virtual Directory Management for SQL Server

Using XPath Queries

Accessing SQL Server Using HTTP

Executing Template Files Using HTTP