XDR Annotations (Deprecated in SQLXML 4.0)

Important

This topic is included as a reference for legacy applications. No future development work will be done on this feature. Avoid using this feature in new development work. Instead, use annotated XSD schemas to create XML views. For more information, see Introduction to Annotated XSD Schemas (SQLXML 4.0). You can convert existing annotated XDR schemas to XSD schemas. For more information, see Converting Annotated XDR Schemas to Equivalent XSD Schemas (SQLXML 4.0).

Microsoft SQL Server 2005 continues to provide a number of annotations to the XDR schema language that were first introduced in SQL Server 2000. 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 following table shows the list of annotations.

Annotation Description Topic link

sql:relation

Maps an XML item to the database table.

Using sql:relation (XDR Schema)

sql:field

Maps an XML item and the database column.

Using sql:field (XDR Schema)

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 (XDR Schema)

sql:map-field

Allows schema items to be excluded from the result.

Excluding Schema Elements from the Resulting XML Document Using sql:map-field (XDR Schema)

<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 (XDR Schema)

sql:limit-fieldsql:limit-value

Allows limiting the values returned based on a limiting value.

Filtering Values by Using sql:limit-field and sql:limit-value (XDR Schema)

sql:key-fields

Allows specification of column(s) that uniquely identify the rows in a table.

Identifying Key Columns Using sql:key-fields (XDR Schema)

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 (XDR Schema)

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 (XDR Schema)

sql:use-cdata

Allows specifying CDATA sections to be used for certain elements in the XML document.

Creating CDATA Sections Using sql:use-cdata (XDR Schema)

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 (XDR Schema)

sql:overflow-field

Identifies the database column that contains the overflow data.

Retrieving Unconsumed Data Using sql:overflow-field (XDR Schema)

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 in SQLXML 4.0