title: Creating XML Schema for elements with the same name?
body: <p>I am trying to create an XSD Schema for an XML document I have received however there are two elements <code>staff</code> which have the same name.</p>
  
  <p>Is there any way to create a schema for this XML even though there are two elements with the same name?</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;contacts&gt;
      &lt;staff count="248" pagesize="284"&gt;
      &lt;staff id="1231"&gt;
      &lt;Forename&gt;test&lt;/Forename&gt;
      &lt;Surname&gt;test&lt;/Surname&gt;
      &lt;DateOfBirth&gt;0000-00-00&lt;/DateOfBirth&gt;
      &lt;Gender/&gt;
      &lt;Address1/&gt;
      &lt;Address2/&gt;
      &lt;Town/&gt;
      &lt;County/&gt;
      &lt;Telephone/&gt;
      &lt;Mobile/&gt;
      &lt;Email/&gt;
      &lt;Created&gt;0000-06-18 09:46:32&lt;/Created&gt;
      &lt;CreatedBy&gt;test&lt;/CreatedBy&gt;
      &lt;Updated&gt;2000-06-18 09:46:32&lt;/Updated&gt;
      &lt;UpdatedBy&gt;test&lt;/UpdatedBy&gt;
      &lt;Archived&gt;0000-00-00 00:00:00&lt;/Archived&gt;
      &lt;ArchivedBy/&gt;
      &lt;Postcode/&gt;
      &lt;Age&gt;0&lt;/Age&gt;
      &lt;RestrictedRecord&gt;0&lt;/RestrictedRecord&gt;
      &lt;Disability_S_24/&gt;
      &lt;Ethnicity_S_25/&gt;
      &lt;Type&gt;8&lt;/Type&gt;
      &lt;PersonID&gt;1231&lt;/PersonID&gt;
      &lt;TypeName&gt;staff&lt;/TypeName&gt;
      &lt;/staff&gt;
  &lt;/staff&gt;
  &lt;/contacts&gt;
  </code></pre>
  
  <p>Schema so far:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;
      &lt;xs:element name="contacts"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="staff"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="staff"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element maxOccurs="unbounded" ref="staff"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="count" use="required" type="xs:integer"/&gt;
              &lt;xs:attribute name="pagesize" use="required" type="xs:integer"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="staff"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:all  &gt;
                  &lt;xs:element ref="Forename" minOccurs="0"/&gt;
                  &lt;xs:element ref="Surname" minOccurs="0"/&gt;
                  &lt;xs:element ref="DateOfBirth" minOccurs="0"/&gt;
                  &lt;xs:element ref="Gender" minOccurs="0"/&gt;
                  &lt;xs:element ref="Address1" minOccurs="0"/&gt;
                  &lt;xs:element ref="Address2" minOccurs="0"/&gt;
                  &lt;xs:element ref="Town" minOccurs="0"/&gt;
                  &lt;xs:element ref="County" minOccurs="0"/&gt;
                  &lt;xs:element ref="Telephone" minOccurs="0"/&gt;
                  &lt;xs:element ref="Mobile" minOccurs="0"/&gt;
                  &lt;xs:element ref="Email" minOccurs="0"/&gt;
                  &lt;xs:element ref="Created" minOccurs="0"/&gt;
                  &lt;xs:element ref="CreatedBy" minOccurs="0"/&gt;
                  &lt;xs:element ref="Updated" minOccurs="0"/&gt;
                  &lt;xs:element ref="UpdatedBy" minOccurs="0"/&gt;
                  &lt;xs:element ref="Archived" minOccurs="0"/&gt;
                  &lt;xs:element ref="ArchivedBy" minOccurs="0"/&gt;
                  &lt;xs:element ref="Postcode" minOccurs="0"/&gt;
                  &lt;xs:element ref="Age" minOccurs="0"/&gt;
                  &lt;xs:element ref="RestrictedRecord" minOccurs="0"/&gt;
                  &lt;xs:element ref="Disability_S_24" minOccurs="0"/&gt;
                  &lt;xs:element ref="Ethnicity_S_25" minOccurs="0"/&gt;
                  &lt;xs:element ref="Education_V_2" minOccurs="0"/&gt;
                  &lt;xs:element ref="EmploymentTrainingStatus_V_1" minOccurs="0"/&gt;
                  &lt;xs:element ref="Type" minOccurs="0"/&gt;
                  &lt;xs:element ref="PersonID" minOccurs="0"/&gt;
                  &lt;xs:element ref="TypeName" minOccurs="0"/&gt;
              &lt;/xs:all&gt;
              &lt;xs:attribute name="id" use="required" type="xs:integer"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="Forename" type="xs:string"/&gt;
      &lt;xs:element name="Surname" type="xs:string"/&gt;
      &lt;xs:element name="DateOfBirth" type="xs:NMTOKEN"/&gt;
      &lt;xs:element name="Gender" type="xs:string"/&gt;
      &lt;xs:element name="Address1" type="xs:string"/&gt;
      &lt;xs:element name="Address2" type="xs:string"/&gt;
      &lt;xs:element name="Town" type="xs:string"/&gt;
      &lt;xs:element name="County" type="xs:string"/&gt;
      &lt;xs:element name="Telephone" type="xs:string"/&gt;
      &lt;xs:element name="Mobile" type="xs:string"/&gt;
      &lt;xs:element name="Email" type="xs:string"/&gt;
      &lt;xs:element name="Created" type="xs:string"/&gt;
      &lt;xs:element name="CreatedBy" type="xs:NCName"/&gt;
      &lt;xs:element name="Updated" type="xs:string"/&gt;
      &lt;xs:element name="UpdatedBy" type="xs:NCName"/&gt;
      &lt;xs:element name="Archived" type="xs:string"/&gt;
      &lt;xs:element name="ArchivedBy" type="xs:string"/&gt;
      &lt;xs:element name="Postcode" type="xs:string"/&gt;
      &lt;xs:element name="Age" type="xs:integer"/&gt;
      &lt;xs:element name="RestrictedRecord" type="xs:integer"/&gt;
      &lt;xs:element name="Disability_S_24"&gt;
          &lt;xs:complexType/&gt;
    &lt;/xs:element&gt;
      &lt;xs:element name="Ethnicity_S_25"&gt;
          &lt;xs:complexType/&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="Type" type="xs:integer"/&gt;
      &lt;xs:element name="PersonID" type="xs:integer"/&gt;
      &lt;xs:element name="TypeName" type="xs:NCName"/&gt;
  &lt;/xs:schema&gt;
  </code></pre>