HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

What Color is Your Schema? by Bogdan Blaszczak
WSJ Vol 04 Issue 10 - pg.53



Listing 1• Sample schema with an <annotation

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!--   *** The XML schema annotation ***   -->
  <xsd:annotation>
    <xsd:documentation> The Corporate Blue Books
       </xsd:documentation>
    <xsd:appinfo>
      <ivi:docs
   xmlns:ivi="http://www.intervoice.com/xml/meta" >
        <ivi:blue/>
        <ivi:public/>
      </ivi:docs>
    </xsd:appinfo>
  </xsd:annotation>
  <!--  *** The XML document structure: a book of rules ***   -->
  <xsd:element name="book">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="rule"
           maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Listing 2• Sample data mapping

<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="CustOrder"
                 parent="Customers"
                 parent-key="CustomerID"
                 child="Orders"
                 child-key="CustomerID" />
    </xsd:appinfo>
  </xsd:annotation>
<!--  *** The schema with declarations of customer and order elements ***   -->
</xsd:schema>

Listing 3• Annotated schema that defines an XML view

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
  <xsd:element name="employee" sql:relation="Employees">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="name" type="xsd:string"
           sql:field="Name"/>
      </xsd:sequence>
    <xsd:attribute name="id" type="xsd:integer"
       sql:field="EmpID"/>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>