<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <!-- author definition -->
   <xsd:complexType name="WriterType">
      <xsd:sequence>
         <xsd:element name="FirstName" type="xsd:string" />
         <xsd:element name="LastName" type="xsd:string" />
         <xsd:element name="Phone" type="xsd:string" />
         <!-- works the author has published -->
         <xsd:element name="Publication" type="PublicationType" />
      </xsd:sequence>
   </xsd:complexType>
   
   <!-- Writer element declaration -->
   <xsd:element name="Writer" type="WriterType"/>
   
   <!-- 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" />
         <xsd:element name="state" type="xsd:string" />
         <!-- authors located in same state as store -->
         <xsd:element ref="Writer" />
      </xsd:sequence>
   </xsd:complexType>
   
   <!-- Bookstore element declaration -->
   <xsd:element name="Bookstore" type="BookstoreType" />
   
   <!-- root element of the document -->
   <xsd:element name="Writers">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="Writer" />
         </xsd:sequence>
     </xsd:complexType>
   </xsd:element>
   
   <!-- alternate root element of the document -->
   <xsd:element name="Bookstores">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="Bookstore" />
         </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
</xsd:schema>