title: XML Schema error "Element not allowed for content model"
body: <p>I am very new to XML and XSD and need a little help. I keep getting this validation error "Element header not allowed for content model (header+, objective*,pubs?). It is appearing at the last line of the XML and I can't figure out what could possibly be causing it. Here is the XSD:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema"  elementFormDefault="qualified"&gt;
  
    &lt;xs:element name="resume"&gt;
      &lt;xs:complexType&gt;
       &lt;xs:sequence&gt;
          &lt;xs:element name="header" minOccurs="1" maxOccurs="unbounded"  &gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element name="name" type="NameType" /&gt;
                &lt;xs:element name="contact" type="ContactType" /&gt;
              &lt;/xs:sequence&gt;
            &lt;/xs:complexType&gt;  
          &lt;/xs:element&gt; 
          &lt;xs:element name="objective" type="ObjectiveType" minOccurs="0" maxOccurs="unbounded"/&gt;
          &lt;xs:element name="pubs" minOccurs="0" maxOccurs="1"&gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element name="pub" type="PubType"  minOccurs="0" maxOccurs="unbounded"/&gt;                  
              &lt;/xs:sequence&gt;                
            &lt;/xs:complexType&gt;           
          &lt;/xs:element&gt;
        &lt;/xs:sequence&gt;  
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;      
  
  
     &lt;xs:complexType name="NameType"&gt;
      &lt;xs:group ref="NameGroup" /&gt;
    &lt;/xs:complexType&gt;
  
     &lt;xs:group name="NameGroup"&gt;
       &lt;xs:sequence&gt;
         &lt;xs:element name="firstname" type="xs:string" /&gt;
         &lt;xs:element name="middlenames" type="xs:string" minOccurs="0" maxOccurs="unbounded" /&gt;
         &lt;xs:element name="surname" type="xs:string" /&gt;
       &lt;/xs:sequence&gt;   
     &lt;/xs:group&gt;
  
     &lt;xs:complexType name="ContactType"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
          &lt;xs:element name="phone" type="xs:string" /&gt;
          &lt;xs:element name="website" type="xs:string" /&gt;
          &lt;xs:element name="email" type="xs:string" /&gt;
          &lt;xs:element name="address" type="xs:string" /&gt;
        &lt;/xs:choice&gt;  
     &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  
      &lt;xs:complexType name="ObjectiveType"&gt;
        &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
          &lt;xs:element name="para" type="xs:string" /&gt; 
        &lt;/xs:sequence&gt;    
      &lt;/xs:complexType&gt;
  
      &lt;xs:complexType name="PubType"&gt;
        &lt;xs:sequence &gt;
          &lt;xs:element name="bookTitle" type="xs:string"  /&gt;
          &lt;xs:element name="date"  minOccurs="0" maxOccurs="1" &gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element name="month" type="xs:string" /&gt;
                &lt;xs:element name="year" type="xs:string" /&gt;
              &lt;/xs:sequence&gt;  
            &lt;/xs:complexType&gt;
            &lt;/xs:element&gt;
          &lt;xs:element name="publisher" type="xs:string" /&gt;
          &lt;xs:element name="url" type="xs:string"  minOccurs="0" maxOccurs="1" /&gt;
         &lt;/xs:sequence&gt;    
      &lt;/xs:complexType&gt;
  
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And here is the XML code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;resume xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="A2_Schema_task2.xsd"&gt;
  
    &lt;header&gt;
      &lt;name&gt;
       &lt;firstname&gt;John&lt;/firstname&gt;
       &lt;middlenames&gt;E.&lt;/middlenames&gt;
       &lt;surname&gt;Doe&lt;/surname&gt;
      &lt;/name&gt;
      &lt;contact&gt;
       &lt;email&gt;jdoe@mycompany.net&lt;/email&gt;
      &lt;/contact&gt;
    &lt;/header&gt;
  
    &lt;objective&gt;
      &lt;para&gt;Seeking a position in publishing as Associate Manager&lt;/para&gt;
      &lt;para&gt;The position will allow me to utilize my experiences to mentor and train my team. &lt;/para&gt;
    &lt;/objective&gt;
  
    &lt;pubs&gt;
      &lt;pub&gt;
        &lt;bookTitle&gt;Just XML&lt;/bookTitle&gt;
        &lt;publisher&gt;Wiley&lt;/publisher&gt;
        &lt;url&gt;http://mycompany/book1&lt;/url&gt;
      &lt;/pub&gt;
  
      &lt;pub&gt;
        &lt;bookTitle&gt;XPath and XPointer&lt;/bookTitle&gt;
        &lt;date&gt;&lt;month&gt;August&lt;/month&gt;&lt;year&gt;2002&lt;/year&gt;&lt;/date&gt;
        &lt;publisher&gt;O'Reilly and Associates&lt;/publisher&gt;
        &lt;url&gt;http://mycompany/book1&lt;/url&gt;
      &lt;/pub&gt;
    &lt;/pubs&gt;
  
    &lt;header&gt;
      &lt;name&gt;
       &lt;firstname&gt;Maya&lt;/firstname&gt;
       &lt;surname&gt;Wells&lt;/surname&gt;
      &lt;/name&gt;
      &lt;contact&gt;
       &lt;phone&gt;416-785-2598&lt;/phone&gt;
      &lt;/contact&gt;
    &lt;/header&gt;
  
    &lt;objective&gt;
      &lt;para&gt;Seeking a position in publishing as Associate Manager&lt;/para&gt;
    &lt;/objective&gt;
  
    &lt;pubs&gt;
      &lt;pub&gt;
        &lt;bookTitle&gt;Just JavaScript&lt;/bookTitle&gt;
        &lt;publisher&gt;Wrox&lt;/publisher&gt;
      &lt;/pub&gt;
    &lt;/pubs&gt;
  
    &lt;header&gt;
      &lt;name&gt;
       &lt;firstname&gt;Irene&lt;/firstname&gt;
       &lt;surname&gt;Mathieu&lt;/surname&gt;
      &lt;/name&gt;
      &lt;contact&gt;
       &lt;phone&gt;905-785-2598&lt;/phone&gt;
       &lt;website&gt;www.irenemathieu.com&lt;/website&gt;
       &lt;email&gt;irenemathieu@gmail.com&lt;/email&gt;
       &lt;address&gt;105 Bathurst Street , Toronto&lt;/address&gt;
      &lt;/contact&gt;
    &lt;/header&gt;
  
    &lt;objective&gt;
      &lt;para&gt;Seeking a position in publishing as Publishing Manager with your company&lt;/para&gt;
     &lt;para&gt;Seasoned manager offering 30 years of progressive experience as a Publishing Manager,  willing to provide advice and leadership for educational publishing in its broadest form.&lt;/para&gt;
    &lt;/objective&gt;
  
  &lt;/resume&gt;
  </code></pre>
  
  <p>Thanks for your help!</p>