<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified">

  <xs:element name="listings">
    <xs:annotation>
      <xs:documentation>
        Encapsulates all the information in the feed. This is the document
        root tag of the XML file.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="language">
          <xs:annotation>
             <xs:documentation>
                This is the language to be used in reporting for this
                feed and the language of the content in the feed.
             </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" ref="provider_info"/>
	<xs:element minOccurs="0" maxOccurs="1" ref="redemption_methods">
          <xs:annotation>
            <xs:documentation>
		List of redemption methods that apply to ALL coupons in
		this feed.  Each coupon can override this global default.
            </xs:documentation>
          </xs:annotation>
	</xs:element>
        <xs:element minOccurs="0" maxOccurs="1" ref="contact_email"/>
        <xs:element minOccurs="0" ref="datum"/>
        <xs:group minOccurs="1" maxOccurs="unbounded" ref="data"/>
      </xs:sequence>
    </xs:complexType>
    <xs:unique name="unique_listing_id">
      <xs:selector xpath=".//listing"/>
      <xs:field xpath="listing_id"/>
    </xs:unique>
    <xs:unique name="unique_coupon_id">
      <xs:selector xpath=".//coupon"/>
      <xs:field xpath="coupon_id"/>
    </xs:unique>
    <xs:unique name="unique_group_id">
      <xs:selector xpath=".//group"/>
      <xs:field xpath="group_id"/>
    </xs:unique>
  </xs:element>

  <xs:element name="provider_info">
    <xs:annotation>
      <xs:documentation>Information about your organization.  This
        is typically only provided by third party providers who wish 
        to apply their own branding to coupons.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="provider_name" minOccurs="0" maxOccurs="1">
          <xs:annotation>
             <xs:documentation>
                 The name of your provider organization.
             </xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1"/>
              <xs:maxLength value="25"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="provider_logo" type="xs:anyURI"
          minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>The URL for the logo of your organization.  
                              This should be a gif, jpg, or png image, 
                              and is allowed to be up to 100 pixels wide 
                              and 21 pixels high.  It may not 
                              contain animation.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="provider_url" type="xs:string" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>The URL of the website for your organization.  
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:group name="data">
    <xs:choice>
      <xs:element ref="listing"/>
      <xs:element ref="coupon"/>
      <xs:element ref="listing_collection"/>
      <xs:element ref="coupon_collection"/>
      <xs:element ref="group"/>
    </xs:choice>
  </xs:group>

  <xs:element name="contact_email">
    <xs:annotation>
      <xs:documentation>Email address to receive error reports from the feed.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9a-zA-Z._\-]+@[0-9a-zA-Z._\-]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="datum">
    <xs:annotation>
      <xs:documentation>
        The datum in use for geographic coordinates.
        Currently supported values:  TOKYO, WGS84
        If this tag is absent, WGS84 is assumed.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="TOKYO"/>
        <xs:enumeration value="tokyo"/>
        <xs:enumeration value="WGS84"/>
        <xs:enumeration value="wgs84"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="language">
    <xs:annotation>
      <xs:documentation>
        A language description. The value must be an ISO 639 lowercase
        2-letter language code 
        (http://www.w3.org/WAI/ER/IG/ert/iso639.htm#2letter).  For 
        example English is en, French is fr.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:language">
        <xs:enumeration value="aa"/>
        <xs:enumeration value="ab"/>
        <xs:enumeration value="af"/>
        <xs:enumeration value="am"/>
        <xs:enumeration value="ar"/>
        <xs:enumeration value="as"/>
        <xs:enumeration value="ay"/>
        <xs:enumeration value="az"/>
        <xs:enumeration value="ba"/>
        <xs:enumeration value="be"/>
        <xs:enumeration value="bg"/>
        <xs:enumeration value="bh"/>
        <xs:enumeration value="bi"/>
        <xs:enumeration value="bn"/>
        <xs:enumeration value="bo"/>
        <xs:enumeration value="br"/>
        <xs:enumeration value="ca"/>
        <xs:enumeration value="co"/>
        <xs:enumeration value="cs"/>
        <xs:enumeration value="cy"/>
        <xs:enumeration value="da"/>
        <xs:enumeration value="de"/>
        <xs:enumeration value="dz"/>
        <xs:enumeration value="el"/>
        <xs:enumeration value="en"/>
        <xs:enumeration value="eo"/>
        <xs:enumeration value="es"/>
        <xs:enumeration value="et"/>
        <xs:enumeration value="eu"/>
        <xs:enumeration value="fa"/>
        <xs:enumeration value="fi"/>
        <xs:enumeration value="fj"/>
        <xs:enumeration value="fo"/>
        <xs:enumeration value="fr"/>
        <xs:enumeration value="fy"/>
        <xs:enumeration value="ga"/>
        <xs:enumeration value="gd"/>
        <xs:enumeration value="gl"/>
        <xs:enumeration value="gn"/>
        <xs:enumeration value="gu"/>
        <xs:enumeration value="ha"/>
        <xs:enumeration value="hi"/>
        <xs:enumeration value="hr"/>
        <xs:enumeration value="hu"/>
        <xs:enumeration value="hy"/>
        <xs:enumeration value="ia"/>
        <xs:enumeration value="ie"/>
        <xs:enumeration value="ik"/>
        <xs:enumeration value="in"/>
        <xs:enumeration value="is"/>
        <xs:enumeration value="it"/>
        <xs:enumeration value="iw"/>
        <xs:enumeration value="ja"/>
        <xs:enumeration value="ji"/>
        <xs:enumeration value="jw"/>
        <xs:enumeration value="ka"/>
        <xs:enumeration value="kk"/>
        <xs:enumeration value="kl"/>
        <xs:enumeration value="km"/>
        <xs:enumeration value="kn"/>
        <xs:enumeration value="ko"/>
        <xs:enumeration value="ks"/>
        <xs:enumeration value="ku"/>
        <xs:enumeration value="ky"/>
        <xs:enumeration value="la"/>
        <xs:enumeration value="ln"/>
        <xs:enumeration value="lo"/>
        <xs:enumeration value="lt"/>
        <xs:enumeration value="lv"/>
        <xs:enumeration value="mg"/>
        <xs:enumeration value="mi"/>
        <xs:enumeration value="mk"/>
        <xs:enumeration value="ml"/>
        <xs:enumeration value="mn"/>
        <xs:enumeration value="mo"/>
        <xs:enumeration value="mr"/>
        <xs:enumeration value="ms"/>
        <xs:enumeration value="mt"/>
        <xs:enumeration value="my"/>
        <xs:enumeration value="na"/>
        <xs:enumeration value="ne"/>
        <xs:enumeration value="nl"/>
        <xs:enumeration value="no"/>
        <xs:enumeration value="oc"/>
        <xs:enumeration value="om"/>
        <xs:enumeration value="or"/>
        <xs:enumeration value="pa"/>
        <xs:enumeration value="pl"/>
        <xs:enumeration value="ps"/>
        <xs:enumeration value="pt"/>
        <xs:enumeration value="qu"/>
        <xs:enumeration value="rm"/>
        <xs:enumeration value="rn"/>
        <xs:enumeration value="ro"/>
        <xs:enumeration value="ru"/>
        <xs:enumeration value="rw"/>
        <xs:enumeration value="sa"/>
        <xs:enumeration value="sd"/>
        <xs:enumeration value="sg"/>
        <xs:enumeration value="sh"/>
        <xs:enumeration value="si"/>
        <xs:enumeration value="sk"/>
        <xs:enumeration value="sl"/>
        <xs:enumeration value="sm"/>
        <xs:enumeration value="sn"/>
        <xs:enumeration value="so"/>
        <xs:enumeration value="sq"/>
        <xs:enumeration value="sr"/>
        <xs:enumeration value="ss"/>
        <xs:enumeration value="st"/>
        <xs:enumeration value="su"/>
        <xs:enumeration value="sv"/>
        <xs:enumeration value="sw"/>
        <xs:enumeration value="ta"/>
        <xs:enumeration value="te"/>
        <xs:enumeration value="tg"/>
        <xs:enumeration value="th"/>
        <xs:enumeration value="ti"/>
        <xs:enumeration value="tk"/>
        <xs:enumeration value="tl"/>
        <xs:enumeration value="tn"/>
        <xs:enumeration value="to"/>
        <xs:enumeration value="tr"/>
        <xs:enumeration value="ts"/>
        <xs:enumeration value="tt"/>
        <xs:enumeration value="tw"/>
        <xs:enumeration value="uk"/>
        <xs:enumeration value="ur"/>
        <xs:enumeration value="uz"/>
        <xs:enumeration value="vi"/>
        <xs:enumeration value="vo"/>
        <xs:enumeration value="wo"/>
        <xs:enumeration value="xh"/>
        <xs:enumeration value="yo"/>
        <xs:enumeration value="zh"/>
        <xs:enumeration value="zu"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <!-- coupon section -->

  <xs:element name="coupon">
    <xs:annotation>
      <xs:documentation>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" ref="redemption_methods"/>
        <xs:element minOccurs="1" maxOccurs="1" ref="coupon_id"/>
        <xs:element minOccurs="1" maxOccurs="1" ref="business_name"/>
        <xs:element minOccurs="1" maxOccurs="1" ref="coupon_title"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="subtitle"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="details"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="expiry_date"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="start_date"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="end_date"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="expiry_period"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="merchant_offer_id"/>
        <xs:element minOccurs="0" maxOccurs="1" name="image_url" type="xs:anyURI">
          <xs:annotation>
            <xs:documentation>
              A URL to fetch a PNG, JPG, or GIF image to appear in the coupon.
              The image should be 120x120, but will be proportionately resized
              if it is larger than this.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
	<xs:element minOccurs="0" maxOccurs="1" name="searchable"
          type="xs:boolean" default="true">
          <xs:annotation>
            <xs:documentation>
              Whether the coupon can be discovered by search.  Setting
              this value to false means that the content will not be indexed by search
              engines.  This allows the provider to control the targeting of their
              coupon via ads or other delivery systems.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:group minOccurs="0" maxOccurs="2" ref="barcode"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="provider_info">
          <xs:annotation>
            <xs:documentation>
              If provider_info is provided at this level, it overrides the provider_info provided at the listings level.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="business_name">
    <xs:annotation>
      <xs:documentation>
          The name of the business as it should appear on the coupon.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="60"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="coupon_id">
    <xs:annotation>
      <xs:documentation>
        A unique identifier of 1-60 characters from a restricted character set.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[\.0-9a-zA-Z\-%$]{1,60}"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="coupon_title">
    <xs:annotation>
      <xs:documentation>
        First headline of text describing the coupon offer.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="80"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="subtitle">
    <xs:annotation>
      <xs:documentation>
        Second line of text describing the coupon offer.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="160"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="details">
    <xs:annotation>
      <xs:documentation>
        Any refinement of the offer beyond the coupon_title and subtitle.
        This includes terms and conditions, if any.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="1000"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="expiry_date">
    <xs:annotation>
      <xs:documentation>
  	The date on which the coupon expires.  This will be printed on
        the coupon.  It is optional.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="date" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="start_date">
    <xs:annotation>
      <xs:documentation>
  	The date on which the coupon can first be presented.  It is optional.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="date" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="end_date">
    <xs:annotation>
      <xs:documentation>
  	The late date on which the coupon can be presented.  It is optional.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="date" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="expiry_period">
    <xs:annotation>
      <xs:documentation>
  	The number of days after printing that a coupon is valid.  It is optional.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:int">
        <xs:minInclusive value="0"/>
        <xs:maxInclusive value="999"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="merchant_offer_id">
    <xs:annotation>
      <xs:documentation>
  	This is printed on the coupon, and is used for clerks to 
        recognize the offer and enter it into a point of sale system.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="30"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:group name="barcode">
    <xs:annotation>
      <xs:documentation>
        Supported barcode types.  Each type has restrictions on
        the type and amount of data that can be encoded.  At most two
        barcodes are allowed for each coupon.  In addition, there is
        a limit on the total amount of data that can be encoded in barcodes
        on a coupon.  This limit depends on the the rendering style of the
        coupon, but is currently set at 32 bytes.
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element ref="UPC_A"/>
      <xs:element ref="EAN_13"/>
      <xs:element ref="UCC_EAN_128"/>
      <xs:element ref="CODE_128"/>
      <xs:element ref="CODE_39"/>
    </xs:choice>
  </xs:group>

  <xs:element name="UPC_A">
    <xs:annotation>
      <xs:documentation>
        UPC-A barcode data.  This consists of a total of 11 or 12 decimal
        digits.  The optional last digit is a check digit.  If
        it is not supplied then we will calculate it.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9]{11}[0-9]?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="EAN_13">
    <xs:annotation>
      <xs:documentation>
        EAN-13 barcode data.  This consists of a total of 12 or 13
        decimal digits, with the first two digits being a number system 
        that corresponds to coupons in the appropriate locale.  The last
        digit is an optional check digit (if not supplied, we will
        supply it).
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9]{12}[0-9]?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="UCC_EAN_128">
    <xs:annotation>
      <xs:documentation>
        EAN-128 barcode data, also known as GS1-128.  The specification of
        these is beyond the scope of this document, and the supplier should
        refer to the UCC standard.  Formats 1-4 are supported.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="(8100[0-9]{6}(21[0-9]+)?)|(8101[0-9]{10}(21[0-9]+)?)|(8102[0-9]{2})"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="CODE_128">
    <xs:annotation>
      <xs:documentation>
        Code 128 barcode data.  The payload consists of up to 32 ascii
        characters.  
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="\p{IsBasicLatin}{1,32}"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="CODE_39">
    <xs:annotation>
      <xs:documentation>
         Code 39 barcode data using up to 20 characters from a restricted
         character set.  No checksum is required in the data.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9A-Z ]{1,20}"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="redemption_methods">
    <xs:annotation>
      <xs:documentation>
	List of redemption methods that apply to coupons.  These can be club_card
	elements or references to club_cards.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
	<xs:choice minOccurs="0" maxOccurs="unbounded">
	  <xs:element ref="club_card"/>
          <xs:element ref="club_card_id"/>
	</xs:choice>
      </xs:sequence>
    </xs:complexType>
    <xs:unique name="unique_club_card_id">
      <xs:selector xpath=".//club_card"/>
      <xs:field xpath="club_card_id"/>
    </xs:unique>
  </xs:element>

  <xs:element name="club_card_id">
    <xs:annotation>
      <xs:documentation>
	Identifier for the club card.  For example, "SuperStoreCard".
	This uniquely identifies a particular brand of club card.
	1-60 characters from a restricted set.
      </xs:documentation>
 </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[\.0-9a-zA-Z\-%$]{1,60}"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="club_card">
    <xs:annotation>
      <xs:documentation>
      Retailer's club card for coupon redemption.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
	<xs:element minOccurs="1" maxOccurs="1" ref="club_card_id"/>
        <xs:element minOccurs="1" maxOccurs="1" name="card_name">
          <xs:annotation>
            <xs:documentation>
            Display name of the club card
            </xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1"/>
              <xs:maxLength value="30"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="1" maxOccurs="1" name="card_logo_url" type="xs:anyURI">
          <xs:annotation>
            <xs:documentation>
            URL for the logo of the club card.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="add_to_card_message">
          <xs:annotation>
            <xs:documentation>
            Message text for call to action to add to club card (e.g. "Add to Card")
            </xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1"/>
              <xs:maxLength value="60"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="1" maxOccurs="1" name="add_to_card_url" type="xs:anyURI">
          <xs:annotation>
            <xs:documentation>
            URL for handling user's action to add coupon to club card.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="business_logo_url" type="xs:anyURI">
          <xs:annotation>
            <xs:documentation>
            URL for the store logo.
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <!-- listing section -->

  <xs:element name="listing">
    <xs:annotation>
      <xs:documentation>
        Encapsulates all the information related to a single business location.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" ref="listing_id"/>
        <xs:element ref="name"/>
        <xs:element ref="address"/>
        <xs:element ref="country"/>
        <xs:element minOccurs="0" ref="latitude"/>
        <xs:element minOccurs="0" ref="longitude"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="phone"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="category"/>
        <xs:element minOccurs="0" ref="date"/>
        <xs:element minOccurs="0" ref="content"/>
        <xs:element minOccurs="0" maxOccurs="1" ref="redemption_methods"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="listing_id">
    <xs:annotation>
      <xs:documentation>
        Unique ID of the listing on your site.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9a-zA-Z\-%$]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="name">
    <xs:annotation>
      <xs:documentation>
        The name of the business.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="address">
    <xs:annotation>
      <xs:documentation>
        Address of the business, including street number, street name,
        town/city, state/province/region, and postal code. Example:
        1600 Amphitheatre Parkway, Mountain View, CA 94043
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:sequence>
	<xs:element minOccurs="0" maxOccurs="unbounded" ref="component"/>
      </xs:sequence>
      <xs:attributeGroup ref="attlist.address"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.address">
    <xs:annotation>
      <xs:documentation>
	The type of address data provided.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="format" default="simple">
      <xs:simpleType>
	<xs:restriction base="xs:string">
	  <xs:enumeration value="simple"/>
	  <xs:enumeration value="detailed"/>
	</xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="component">
    <xs:annotation>
      <xs:documentation>
	A particular component of an address.  Example:
	<component name="addr1">1600 Amphitheatre Parkway</component>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.component"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.component">
    <xs:annotation>
      <xs:documentation>
	The type of address component provided.  Example: addr1
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" use="required">
      <xs:simpleType>
	<xs:restriction base="xs:string">
	  <xs:minLength value="1"/>
	</xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="country">
    <xs:annotation>
      <xs:documentation>
        The country that this listing is located in. The value must be a
        ISO 3116 uppercase 2-letter country code (http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html).
        For example, United States is US and Canada is CA.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="AD"/>
        <xs:enumeration value="AE"/>
        <xs:enumeration value="AF"/>
        <xs:enumeration value="AG"/>
        <xs:enumeration value="AI"/>
        <xs:enumeration value="AL"/>
        <xs:enumeration value="AM"/>
        <xs:enumeration value="AN"/>
        <xs:enumeration value="AO"/>
        <xs:enumeration value="AQ"/>
        <xs:enumeration value="AR"/>
        <xs:enumeration value="AS"/>
        <xs:enumeration value="AT"/>
        <xs:enumeration value="AU"/>
        <xs:enumeration value="AW"/>
        <xs:enumeration value="AX"/>
        <xs:enumeration value="AZ"/>
        <xs:enumeration value="BA"/>
        <xs:enumeration value="BB"/>
        <xs:enumeration value="BD"/>
        <xs:enumeration value="BE"/>
        <xs:enumeration value="BF"/>
        <xs:enumeration value="BG"/>
        <xs:enumeration value="BH"/>
        <xs:enumeration value="BI"/>
        <xs:enumeration value="BJ"/>
        <xs:enumeration value="BM"/>
        <xs:enumeration value="BN"/>
        <xs:enumeration value="BO"/>
        <xs:enumeration value="BR"/>
        <xs:enumeration value="BS"/>
        <xs:enumeration value="BT"/>
        <xs:enumeration value="BV"/>
        <xs:enumeration value="BW"/>
        <xs:enumeration value="BY"/>
        <xs:enumeration value="BZ"/>
        <xs:enumeration value="CA"/>
        <xs:enumeration value="CC"/>
        <xs:enumeration value="CD"/>
        <xs:enumeration value="CF"/>
        <xs:enumeration value="CG"/>
        <xs:enumeration value="CH"/>
        <xs:enumeration value="CI"/>
        <xs:enumeration value="CK"/>
        <xs:enumeration value="CL"/>
        <xs:enumeration value="CM"/>
        <xs:enumeration value="CN"/>
        <xs:enumeration value="CO"/>
        <xs:enumeration value="CR"/>
        <xs:enumeration value="CS"/>
        <xs:enumeration value="CU"/>
        <xs:enumeration value="CV"/>
        <xs:enumeration value="CX"/>
        <xs:enumeration value="CY"/>
        <xs:enumeration value="CZ"/>
        <xs:enumeration value="DE"/>
        <xs:enumeration value="DJ"/>
        <xs:enumeration value="DK"/>
        <xs:enumeration value="DM"/>
        <xs:enumeration value="DO"/>
        <xs:enumeration value="DZ"/>
        <xs:enumeration value="EC"/>
        <xs:enumeration value="EE"/>
        <xs:enumeration value="EG"/>
        <xs:enumeration value="EH"/>
        <xs:enumeration value="ER"/>
        <xs:enumeration value="ES"/>
        <xs:enumeration value="ET"/>
        <xs:enumeration value="FI"/>
        <xs:enumeration value="FJ"/>
        <xs:enumeration value="FK"/>
        <xs:enumeration value="FM"/>
        <xs:enumeration value="FO"/>
        <xs:enumeration value="FR"/>
        <xs:enumeration value="GA"/>
        <xs:enumeration value="GB"/>
        <xs:enumeration value="GD"/>
        <xs:enumeration value="GE"/>
        <xs:enumeration value="GF"/>
        <xs:enumeration value="GH"/>
        <xs:enumeration value="GI"/>
        <xs:enumeration value="GL"/>
        <xs:enumeration value="GM"/>
        <xs:enumeration value="GN"/>
        <xs:enumeration value="GP"/>
        <xs:enumeration value="GQ"/>
        <xs:enumeration value="GR"/>
        <xs:enumeration value="GS"/>
        <xs:enumeration value="GT"/>
        <xs:enumeration value="GU"/>
        <xs:enumeration value="GW"/>
        <xs:enumeration value="GY"/>
        <xs:enumeration value="HK"/>
        <xs:enumeration value="HM"/>
        <xs:enumeration value="HN"/>
        <xs:enumeration value="HR"/>
        <xs:enumeration value="HT"/>
        <xs:enumeration value="HU"/>
        <xs:enumeration value="ID"/>
        <xs:enumeration value="IE"/>
        <xs:enumeration value="IL"/>
        <xs:enumeration value="IN"/>
        <xs:enumeration value="IO"/>
        <xs:enumeration value="IQ"/>
        <xs:enumeration value="IR"/>
        <xs:enumeration value="IS"/>
        <xs:enumeration value="IT"/>
        <xs:enumeration value="JM"/>
        <xs:enumeration value="JO"/>
        <xs:enumeration value="JP"/>
        <xs:enumeration value="KE"/>
        <xs:enumeration value="KG"/>
        <xs:enumeration value="KH"/>
        <xs:enumeration value="KI"/>
        <xs:enumeration value="KM"/>
        <xs:enumeration value="KN"/>
        <xs:enumeration value="KP"/>
        <xs:enumeration value="KR"/>
        <xs:enumeration value="KW"/>
        <xs:enumeration value="KY"/>
        <xs:enumeration value="KZ"/>
        <xs:enumeration value="LA"/>
        <xs:enumeration value="LB"/>
        <xs:enumeration value="LC"/>
        <xs:enumeration value="LI"/>
        <xs:enumeration value="LK"/>
        <xs:enumeration value="LR"/>
        <xs:enumeration value="LS"/>
        <xs:enumeration value="LT"/>
        <xs:enumeration value="LU"/>
        <xs:enumeration value="LV"/>
        <xs:enumeration value="LY"/>
        <xs:enumeration value="MA"/>
        <xs:enumeration value="MC"/>
        <xs:enumeration value="MD"/>
        <xs:enumeration value="MG"/>
        <xs:enumeration value="MH"/>
        <xs:enumeration value="MK"/>
        <xs:enumeration value="ML"/>
        <xs:enumeration value="MM"/>
        <xs:enumeration value="MN"/>
        <xs:enumeration value="MO"/>
        <xs:enumeration value="MP"/>
        <xs:enumeration value="MQ"/>
        <xs:enumeration value="MR"/>
        <xs:enumeration value="MS"/>
        <xs:enumeration value="MT"/>
        <xs:enumeration value="MU"/>
        <xs:enumeration value="MV"/>
        <xs:enumeration value="MW"/>
        <xs:enumeration value="MX"/>
        <xs:enumeration value="MY"/>
        <xs:enumeration value="MZ"/>
        <xs:enumeration value="NA"/>
        <xs:enumeration value="NC"/>
        <xs:enumeration value="NE"/>
        <xs:enumeration value="NF"/>
        <xs:enumeration value="NG"/>
        <xs:enumeration value="NI"/>
        <xs:enumeration value="NL"/>
        <xs:enumeration value="NO"/>
        <xs:enumeration value="NP"/>
        <xs:enumeration value="NR"/>
        <xs:enumeration value="NU"/>
        <xs:enumeration value="NZ"/>
        <xs:enumeration value="OM"/>
        <xs:enumeration value="PA"/>
        <xs:enumeration value="PE"/>
        <xs:enumeration value="PF"/>
        <xs:enumeration value="PG"/>
        <xs:enumeration value="PH"/>
        <xs:enumeration value="PK"/>
        <xs:enumeration value="PL"/>
        <xs:enumeration value="PM"/>
        <xs:enumeration value="PN"/>
        <xs:enumeration value="PR"/>
        <xs:enumeration value="PS"/>
        <xs:enumeration value="PT"/>
        <xs:enumeration value="PW"/>
        <xs:enumeration value="PY"/>
        <xs:enumeration value="QA"/>
        <xs:enumeration value="RE"/>
        <xs:enumeration value="RO"/>
        <xs:enumeration value="RU"/>
        <xs:enumeration value="RW"/>
        <xs:enumeration value="SA"/>
        <xs:enumeration value="SB"/>
        <xs:enumeration value="SC"/>
        <xs:enumeration value="SD"/>
        <xs:enumeration value="SE"/>
        <xs:enumeration value="SG"/>
        <xs:enumeration value="SH"/>
        <xs:enumeration value="SI"/>
        <xs:enumeration value="SJ"/>
        <xs:enumeration value="SK"/>
        <xs:enumeration value="SL"/>
        <xs:enumeration value="SM"/>
        <xs:enumeration value="SN"/>
        <xs:enumeration value="SO"/>
        <xs:enumeration value="SR"/>
        <xs:enumeration value="ST"/>
        <xs:enumeration value="SV"/>
        <xs:enumeration value="SY"/>
        <xs:enumeration value="SZ"/>
        <xs:enumeration value="TC"/>
        <xs:enumeration value="TD"/>
        <xs:enumeration value="TF"/>
        <xs:enumeration value="TG"/>
        <xs:enumeration value="TH"/>
        <xs:enumeration value="TJ"/>
        <xs:enumeration value="TK"/>
        <xs:enumeration value="TL"/>
        <xs:enumeration value="TM"/>
        <xs:enumeration value="TN"/>
        <xs:enumeration value="TO"/>
        <xs:enumeration value="TR"/>
        <xs:enumeration value="TT"/>
        <xs:enumeration value="TV"/>
        <xs:enumeration value="TW"/>
        <xs:enumeration value="TZ"/>
        <xs:enumeration value="UA"/>
        <xs:enumeration value="UG"/>
        <xs:enumeration value="UM"/>
        <xs:enumeration value="US"/>
        <xs:enumeration value="UY"/>
        <xs:enumeration value="UZ"/>
        <xs:enumeration value="VA"/>
        <xs:enumeration value="VC"/>
        <xs:enumeration value="VE"/>
        <xs:enumeration value="VG"/>
        <xs:enumeration value="VI"/>
        <xs:enumeration value="VN"/>
        <xs:enumeration value="VU"/>
        <xs:enumeration value="WF"/>
        <xs:enumeration value="WS"/>
        <xs:enumeration value="YE"/>
        <xs:enumeration value="YT"/>
        <xs:enumeration value="ZA"/>
        <xs:enumeration value="ZM"/>
        <xs:enumeration value="ZW"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="latitude">
    <xs:annotation>
      <xs:documentation>
        The latitude that corresponds to the location of the listing.
        For example, the latitude for 1600 Amphitheatre Parkway,
        Mountain View, CA 94043 is 37.423738.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:float">
        <xs:minInclusive value="-90.0"/>
        <xs:maxInclusive value="90.0"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="longitude">
    <xs:annotation>
      <xs:documentation>
        The longitude that corresponds to the location of the listing.
        For example, the latitude for 1600 Amphitheatre Parkway,
        Mountain View, CA 94043 is -122.090101.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:float">
        <xs:minInclusive value="-180.0"/>
        <xs:maxInclusive value="180.0"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="phone">
    <xs:annotation>
      <xs:documentation>
        The phone number of the business.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.phone"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.phone">
    <xs:attribute name="type" use="required">
      <xs:annotation>
        <xs:documentation>
          The type of the phone number.
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="main">
            <xs:annotation>
              <xs:documentation>
                Main voice telephone number.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="tollfree">
            <xs:annotation>
              <xs:documentation>
                Toll free telephone number.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="fax">
            <xs:annotation>
              <xs:documentation>
                Fax telephone number.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="tdd">
            <xs:annotation>
              <xs:documentation>
                Telecommunications Device for the Deaf telephone number.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="mobile">
            <xs:annotation>
              <xs:documentation>
                Mobile telephone number.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="category">
    <xs:annotation>
      <xs:documentation>
        The category that the listing belongs to (based on your site's
        taxonomy). Example: Restaurants - Chinese
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="content">
    <xs:annotation>
      <xs:documentation>
        Encapsulates all the content relevant to a listing.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="text"/>
        <xs:element ref="review"/>
        <xs:element ref="image"/>
        <xs:element ref="attributes"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

  <xs:element name="text">
    <xs:annotation>
      <xs:documentation>
        Encapsulates a block of text about the listing such as a
        description or a restaurant menu.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="link"/>
        <xs:element minOccurs="0" ref="title"/>
        <xs:element minOccurs="0" ref="author"/>
        <xs:element ref="body"/>
        <xs:element minOccurs="0" ref="date"/>
      </xs:sequence>
      <xs:attributeGroup ref="attlist.text"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.text">
    <xs:attribute name="type">
      <xs:annotation>
        <xs:documentation>
          The type of the text.
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="description">
            <xs:annotation>
              <xs:documentation>
                If the contents are a general description of the business.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="menu">
            <xs:annotation>
              <xs:documentation>
                If the contents are a restaurant menu.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="review">
    <xs:annotation>
      <xs:documentation>
        Encapsulates a single review of the listing.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="link"/>
        <xs:element minOccurs="0" ref="title"/>
        <xs:element minOccurs="0" ref="author"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="rating"/>
        <xs:element ref="body"/>
        <xs:element minOccurs="0" ref="date"/>
      </xs:sequence>
      <xs:attributeGroup ref="attlist.review"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.review">
    <xs:attribute name="type" use="required">
      <xs:annotation>
        <xs:documentation>
          The type of the review.
        </xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="editorial">
            <xs:annotation>
              <xs:documentation>
                Review was written by a member of your staff.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
          <xs:enumeration value="user">
            <xs:annotation>
              <xs:documentation>
                Review was written by a user of your site.
              </xs:documentation>
            </xs:annotation>
          </xs:enumeration>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="image">
    <xs:annotation>
      <xs:documentation>
        Encapsulates an image relevant to the listing.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="link"/>
        <xs:element minOccurs="0" ref="title"/>
        <xs:element minOccurs="0" ref="author"/>
        <xs:element minOccurs="0" ref="date"/>
      </xs:sequence>
      <xs:attributeGroup ref="attlist.image"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.image">
    <xs:attribute name="type" use="required">
      <xs:annotation>
        <xs:documentation>The image type.</xs:documentation>
      </xs:annotation>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="ad"/>
          <xs:enumeration value="menu"/>
          <xs:enumeration value="photo"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="url" type="xs:anyURI" use="required">
      <xs:annotation>
        <xs:documentation>The URL of the full-sized image</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="width" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>The width of the image</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="height" type="xs:unsignedInt">
      <xs:annotation>
        <xs:documentation>The height of the image</xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="attributes">
    <xs:annotation>
      <xs:documentation>
        Encapsulates a set of attributes about the listing. All attributes
        must be displayed on a single page on your site. If you have
        multiple pages that contain attributes, then include each page as
        a separate attributes tag.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="link"/>
        <xs:element minOccurs="0" ref="title"/>
        <xs:element minOccurs="0" ref="author"/>
        <xs:element minOccurs="0" ref="email"/>
        <xs:element minOccurs="0" ref="website"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="attr"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="hiddenattr"/>
        <xs:element minOccurs="0" ref="date"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="attr">
    <xs:annotation>
      <xs:documentation>
        A single piece of structured information about the listing.
        For example, if the name is Business Hours then the value can
        be Mon-Fri 9am-5pm. If the name is Payment Types Accepted,
        then the value can be Cash, Visa, Mastercard. Use the names and
        values that appear on your site.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.attr"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.attr">
    <xs:attribute name="name" use="required">
      <xs:annotation>
        <xs:documentation>
          The name of the field displayed on your site.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="priority" type="xs:integer">
      <xs:annotation>
        <xs:documentation>
          The importance of the fact, which may effect the order
          in which facts are displayed in search results.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="hiddenattr">
    <xs:annotation>
      <xs:documentation>
        A single piece of structured information about the listing,
        which should be hidden from users, because it is used for some
	internal purpose.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.hiddenattr"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.hiddenattr">
    <xs:attribute name="name" use="required">
      <xs:annotation>
        <xs:documentation>
          The name of the hidden field.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="link" type="xs:anyURI">
    <xs:annotation>
      <xs:documentation>
        The URL of the page on your site that contains the content. We will
        link the teaser on Google Local to this page.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:element name="title">
    <xs:annotation>
      <xs:documentation>
        A short summary of the content.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="author">
    <xs:annotation>
      <xs:documentation>
        The name of the author of the content. The value can either be
        a user name or a full name in the format "Firstname Lastname".
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="body">
    <xs:annotation>
      <xs:documentation>
        The entire text of a review or description of the listing. Can
        contain escaped HTML
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="website" type="xs:anyURI">
    <xs:annotation>
      <xs:documentation>
        The official website of the business.
      </xs:documentation>
    </xs:annotation>
  </xs:element>

  <xs:element name="email">
    <xs:annotation>
      <xs:documentation>
        The email address for consumers to use when contacting the business.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[a-zA-Z_0-9\.\-]+@([a-zA-Z_0-9\-]+\.)+[a-zA-Z]{2,4}"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="rating">
    <xs:annotation>
      <xs:documentation>
        If applicable, the rating score associated with the review. The value
        should reflect how the rating appears on your site. If there are
        multiple ratings for a single review, then use a separate rating tag
        for each rating.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.rating"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.rating">
    <xs:attribute name="name">
      <xs:annotation>
        <xs:documentation>
          Type of the rating such as "Service" or "Food Quality". If there is
          only one rating score in the review, then name may be omitted.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>

  <xs:element name="date">
    <xs:annotation>
      <xs:documentation>
        The date the listing or piece of content was created.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="attlist.date"/>
    </xs:complexType>
  </xs:element>

  <xs:attributeGroup name="attlist.date">
    <xs:attribute name="year" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:unsignedInt">
          <xs:minInclusive value="1990"/>
          <xs:maxInclusive value="2099"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="month" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:unsignedInt">
          <xs:minInclusive value="1"/>
          <xs:maxInclusive value="12"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="day">
      <xs:simpleType>
        <xs:restriction base="xs:unsignedInt">
          <xs:minInclusive value="1"/>
          <xs:maxInclusive value="31"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>

  <!-- group section -->

  <xs:element name="listing_collection">
   <xs:annotation>
    <xs:documentation>
      A set of listings along with an id.
    </xs:documentation>
   </xs:annotation>
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="listing_collection_id"/>
       <xs:element minOccurs="1" maxOccurs="unbounded" ref="listing_id"/>
     </xs:sequence>
   </xs:complexType>
  </xs:element>

  <xs:element name="coupon_collection">
   <xs:annotation>
    <xs:documentation>
      A set of coupons along with an id.
    </xs:documentation>
   </xs:annotation>
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="coupon_collection_id"/>
       <xs:element minOccurs="1" maxOccurs="unbounded" ref="coupon_id"/>
     </xs:sequence>
   </xs:complexType>
  </xs:element>

  <xs:element name="listing_collection_id">
    <xs:annotation>
      <xs:documentation>A unique identifier for an listing collection.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9a-zA-Z_\-%$]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name="coupon_collection_id">
    <xs:annotation>
      <xs:documentation>A unique identifier for an coupon collection.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[0-9a-zA-Z_\-%$]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:group name="coupon_selection">
    <xs:choice>
      <xs:element minOccurs="1" maxOccurs="1" ref="all_coupons"/>
      <xs:element minOccurs="1" maxOccurs="unbounded" ref="coupon_id"/>
      <xs:element minOccurs="1" maxOccurs="1" ref="coupon_collection_id"/>
    </xs:choice>
  </xs:group>

  <xs:group name="listing_selection">
    <xs:choice>
      <xs:element minOccurs="1" maxOccurs="1" ref="all_listings"/>
      <xs:element minOccurs="1" maxOccurs="unbounded" ref="listing_id"/>
      <xs:element minOccurs="1" maxOccurs="1" ref="listing_collection_id"/>
    </xs:choice>
  </xs:group>

  <xs:element name="all_listings">
    <xs:annotation>
      <xs:documentation>
        Presence of this element indicates that all listing nodes in the feed
	are included in a group.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
    </xs:complexType>
  </xs:element>

  <xs:element name="all_coupons">
    <xs:annotation>
      <xs:documentation>
        Presence of this element indicates that all coupons in the feed
	are included in a group.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
    </xs:complexType>
  </xs:element>

  <xs:element name="group">
    <xs:annotation>
      <xs:documentation>
         A group consists of a set of listings and coupons, along with 
         an id.  These are used for two purposes, namely to describe that
         all coupons in the group are valid at all listings, and to describe
         a possible landing page for Google to host.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="group_id"/>
        <xs:group ref="listing_selection"/>
        <xs:group ref="coupon_selection"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="group_id">
    <xs:annotation>
      <xs:documentation>
        A unique identifier from a restricted character set.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="[\.0-9a-zA-Z_\-%$]+"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

</xs:schema>
