Explicit Mapping of XDR Elements and Attributes to Tables and Columns

XML and Internet Support

XML and Internet Support

Explicit Mapping of XDR Elements and Attributes to Tables and Columns

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 subelements with text-only content) maps to the column name. If the element/attribute name is the same as a table (view)/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 (view)/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

Maps an XML element to a database table.

sql:field

Maps an attribute or a noncomplex subelement 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.

See Also

Default Mapping of XDR Elements and Attributes to Tables and Columns