title: validating repeating element groups with schema
body: <p>I am having great difficulties trying to make my xml validate against my schema.
  The following error occurs:</p>
  
  <pre><code>   Element 'date': This element is not expected. Expected is ( race ).
  Element 'date': This element is not expected. Expected is ( race ).
  Element 'date': This element is not expected. Expected is ( race ).
  Element 'date': This element is not expected. Expected is ( race ). 
  </code></pre>
  
  <p>The following is my schema
       
      
          
              
                  
                  
                  
              
          
          
              
                  
                  
              
          </p>
  
  <pre><code>&lt;!-- Structure definition --&gt;
      &lt;xs:element name="history"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="period" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="period"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="date" minOccurs="1" maxOccurs="unbounded"/&gt;
                  &lt;xs:element ref="track" minOccurs="1" maxOccurs="unbounded"/&gt;
                  &lt;xs:element ref="race" minOccurs="1" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="year" type="Tyear"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="date"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="track"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="race"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="rider" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="nr" type="Tracenr"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="rider"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="place" maxOccurs="1"/&gt;
                  &lt;xs:element ref="first_name" maxOccurs="1"/&gt;
                  &lt;xs:element ref="last_name" maxOccurs="1"/&gt;
                  &lt;xs:element ref="manufacturer" maxOccurs="1"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="place"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="first_name"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="last_name"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="manufacturer"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"/&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And this is a small snapshot of my xml</p>
  
  <pre><code>&lt;history&gt;
    &lt;period year="2011"&gt;
      &lt;date&gt;10/16/2011&lt;/date&gt;
      &lt;track&gt;Portimao&lt;/track&gt;
      &lt;race nr="1"&gt;
        &lt;rider&gt;
          &lt;place&gt;1&lt;/place&gt;
          &lt;first_name&gt;Marco&lt;/first_name&gt;
          &lt;last_name&gt;Melandri&lt;/last_name&gt;
          &lt;manufacturer&gt;Yamaha&lt;/manufacturer&gt;
        &lt;/rider&gt;
        &lt;rider&gt;
          &lt;place&gt;2&lt;/place&gt;
          &lt;first_name&gt;Eugene&lt;/first_name&gt;
          &lt;last_name&gt;Laverty&lt;/last_name&gt;
          &lt;manufacturer&gt;Yamaha&lt;/manufacturer&gt;
        &lt;/rider&gt;
        [...]
        &lt;rider&gt;
          &lt;place&gt;DNF&lt;/place&gt;
          &lt;first_name&gt;Tom&lt;/first_name&gt;
          &lt;last_name&gt;Sykes&lt;/last_name&gt;
          &lt;manufacturer&gt;Kawasaki&lt;/manufacturer&gt;
        &lt;/rider&gt;
      &lt;/race&gt;
      &lt;date&gt;10/16/2011&lt;/date&gt;
      &lt;track&gt;Portimao&lt;/track&gt;
      &lt;race nr="2"&gt;
        &lt;rider&gt;
          &lt;place&gt;1&lt;/place&gt;
          &lt;first_name&gt;Carlos&lt;/first_name&gt;
          &lt;last_name&gt;Checa&lt;/last_name&gt;
          &lt;manufacturer&gt;Ducati&lt;/manufacturer&gt;
        &lt;/rider&gt;
        &lt;rider&gt;
          &lt;place&gt;2&lt;/place&gt;
          &lt;first_name&gt;Sylvain&lt;/first_name&gt;
          &lt;last_name&gt;Guintoli&lt;/last_name&gt;
          &lt;manufacturer&gt;Ducati&lt;/manufacturer&gt;
        &lt;/rider&gt;
        [...]
        &lt;rider&gt;
          &lt;place&gt;15&lt;/place&gt;
          &lt;first_name&gt;Noriyuki&lt;/first_name&gt;
          &lt;last_name&gt;Haga&lt;/last_name&gt;
          &lt;manufacturer&gt;Aprilia&lt;/manufacturer&gt;
        &lt;/rider&gt;
      &lt;/race&gt;
      &lt;date&gt;10/02/2011&lt;/date&gt;
      &lt;track&gt;Magny-Cours&lt;/track&gt;
      &lt;race nr="1"&gt;
        &lt;rider&gt;
          &lt;place&gt;1&lt;/place&gt;
          &lt;first_name&gt;Carlos&lt;/first_name&gt;
          &lt;last_name&gt;Checa&lt;/last_name&gt;
          &lt;manufacturer&gt;Ducati&lt;/manufacturer&gt;
        &lt;/rider&gt;
        [...]
  </code></pre>
  
  <p>The "period" repeats 3 more times for the previous years.
  Thank you kindly</p>