xml_load_mapping_schema_decl takes a file containing mapping schema and creates a xml view.
The xml view created by
xml_load_mapping_schema_decl (
'http://localhost.localdomain/xmlrepository',
'catmp.xsd', 'UTF-8', 'x-any');
from the file catmp.xsd containing the following mapping schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="CategoryProduct"
parent="Demo.demo.Categories"
parent-key="CategoryID"
child="Demo.demo.Products"
child-key="CategoryID" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="category" sql:relation="Demo.demo.Categories" type="CategoryType" />
<xsd:complexType name="CategoryType" >
<xsd:sequence>
<xsd:element name="product"
sql:relation="Demo.demo.Products"
sql:relationship="CategoryProduct" >
<xsd:complexType>
<xsd:attribute name="ProductName" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="CategoryID" type="xsd:integer" />
<xsd:attribute name="description" sql:field="Description" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
is identical to xml view created by
create xml view "cat" as
{
"Demo"."demo"."Categories" "C" as "category"
("CategoryID", "Description" as "description")
{
"Demo"."demo"."Products" "P" as "product" ("ProductName")
on ("P"."CategoryID" = "C"."CategoryID")
}
}