© Microsoft Corporation. All rights reserved.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<!-- author definition -->
<xsd:complexType name="WriterType">
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string"
sql:field="au_fname"/>
<xsd:element name="LastName" type="xsd:string"
sql:field="au_lname"/>
<xsd:element name="Phone" type="xsd:string" />
<!-- works the author has published -->
<xsd:element name="Publication" type="PublicationType"
sql:relation="titles">
<xsd:annotation>
<xsd:appinfo>
BEGIN CALLOUT A <sql:relationship parent="authors"
parent-key="au_id"
child="titleauthor"
child-key="au_id" />
<sql:relationship parent="titleauthor"
parent-key="title_id"
child="titles"
child-key="title_id" />
END CALLOUT A </xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
BEGIN CALLOUT B <!-- Writer element declaration -->
<xsd:element name="Writer" type="WriterType"
sql:key-fields="au_id"
sql:relation="authors" />
END CALLOUT B
<!-- publication definition -->
<xsd:complexType name="PublicationType">
<xsd:attribute name="title" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
</xsd:complexType>
<!-- store definition -->
<xsd:complexType name="BookstoreType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"
sql:field="stor_name" />
<xsd:element name="state" type="xsd:string" />
<!-- authors located in same state as store -->
<xsd:element ref="Writer">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship parent="stores"
parent-key="state"
child="authors"
child-key="state" />
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
BEGIN CALLOUT C
<!-- Bookstore element declaration -->
<xsd:element name="Bookstore" type="BookstoreType"
sql:key-fields="stor_id"
sql:relation="stores" />
END CALLOUT C
BEGIN CALLOUT D <!-- root element of the document -->
<xsd:element name="Writers" sql:is-constant="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Writer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- alternate root element of the document -->
<xsd:element name="Bookstores" sql:is-constant="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Bookstore" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
END CALLOUT D </xsd:schema>