Name

xml_load_mapping_schema_decl — creates a xml view from mapping schema.

Synopsis

xml_load_mapping_schema_decl ( in base_uri varchar ,
in mapping_schema_file varchar ,
in content_encoding varchar ,
in content_language varchar );

Description

xml_load_mapping_schema_decl takes a file containing mapping schema and creates a xml view.

Parameters

base_uri

in HTML parser mode change all absolute references to relative from given base_uri (http://<host>:<port>/<path>)

mapping_schema_file

well formed XML document containing a mapping schema

content_encoding

string with content encoding type of <document>; valid are 'ASCII', 'ISO', 'UTF8', 'ISO8859-1', 'LATIN-1' etc., defaults are 'UTF-8' for XML mode and 'LATIN-1' for HTML mode

content_language

string with language tag of content of <document>; valid names are listed in IETF RFC 1766, default is 'x-any' (it means 'mix of words from various human languages)

Example24.514.Creating a xml view from a mapping schema

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")
    }
}