Using Annotated XSD Schemas for Creating XML Views tutorial
Overview Mapping Schemas

## Mapping Schemas as XML views.

XML views of relational data is similar to creating views by using CREATE VIEW statements. XML views can be created by using the XML Schema Definition (XSD) language, and then can be queried by using XML Path language (XPATH) queries or XML Query (XQUERY) queries with using `xmlview` function.

An XSD schema with the special set of annotations is referred to as a mapping schema. These annotations are used within the XSD schema to specify XML data to relational store 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 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/attribute. These annotations can also be used to specify the hierarchical relationships in XML (thus, representing the relationships in the database because XSD schemas are simply an XML view of relational data).

A file containg a mapping schema may be loaded by calling the `xml_load_mapping_schema_decl` function. A name (without extension .xsd) of the file containg a mapping schema is considered to be the name of the xml view, defined by a given mapping schema.