Explicit Mapping of XDR Elements and Attributes to Tables and Columns
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).
In providing an XML view of the relational database through an XDR schema, the elements and attributes in the schema must be mapped to database tables and columns. The rows in the database table/view will map to elements in XML. The column values in the database map to attributes or elements. To obtain a single value from the database, the mapping specified in the mapping XDR schema must have both relation and field specification.
By default, an element name in an annotated schema maps to the table/view name in the specified database, and the attribute name (and noncomplex child elements with text-only content) maps to the column name. If the element/attribute name is the same as a table/column name in the database, there is no need to explicitly specify any mappings.
However, if the element/attribute name is not the same as the table/column name in the database, the following annotations are used to specify the mapping between an element/attribute in an XML document and the table/column in a database: sql:relation, which maps an XML element to a database table; and sql:field, which maps an attribute or a noncomplex child element to a database column.
When XPath queries are specified against the annotated XDR schema, the data for the elements and attributes in the schema is retrieved from the tables and columns to which they map.
In This Section
- Using sql:relation (XDR Schema)
Describes and provides examples of the sql:relation annotation.
- Using sql:field (XDR Schema)
Describes and provides examples of the sql:field annotation.
See Also
Reference
Default Mapping of XDR Elements and Attributes to Tables and Columns