title: How to define multiple elements in XML Schema with the same name and different attribute value allowed?
body: <p>I would like to create XML Schema for this chunk of xml, I would like to restrict the values of "name" attribute, so that in output document on and only one instance of day is allowed for each week day:</p>
  
  <pre><code>&lt;a&gt;
    &lt;day name="monday" /&gt;
    &lt;day name="tuesday" /&gt;
    &lt;day name="wednesday" /&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>I have tried to use this:</p>
  
  <pre><code> &lt;xs:complexType name="a"&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="day" minOccurs="1" maxOccurs="1"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:attribute name="name" use="required"&gt;
            &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                &lt;xs:enumeration value="monday" /&gt;
              &lt;/xs:restriction&gt;
            &lt;/xs:simpleType&gt;
          &lt;/xs:attribute&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="day" minOccurs="1" maxOccurs="1"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:attribute name="name" use="required"&gt;
            &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                &lt;xs:enumeration value="tuesday" /&gt;
              &lt;/xs:restriction&gt;
            &lt;/xs:simpleType&gt;
          &lt;/xs:attribute&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>but XML Schema validator in eclipse says error "Multiple elements with name 'day', with different types, appear in the model group.".</p>
  
  <p>Is there any other way?</p>