title: XSD complains with "Multiple elements with name 'B', with different types, appear in the model group."
body: <p>I have the following XSD:</p>
  
  <pre><code>&lt;xs:complexType name="typeBroken"&gt;
    &lt;xs:choice&gt;
      &lt;xs:element name="B"&gt;
        &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:pattern value="FOO|BAR" /&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="A"&gt;
          &lt;xs:simpleType&gt;
            &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:maxLength value="5" /&gt;
            &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
        &lt;/xs:element&gt;
        &lt;xs:element name="B"&gt;
          &lt;xs:simpleType&gt;
            &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:maxLength value="3" /&gt;
            &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:choice&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>So, I would like the presence of 'A' to make 'B' to have a different validation. Is this possible? For example:</p>
  
  <pre><code>&lt;test&gt;&lt;B&gt;FOO&lt;/B&gt;&lt;/test&gt;
  &lt;test&gt;&lt;A&gt;HELLO&lt;/A&gt;&lt;B&gt;BAZ&lt;/B&gt;&lt;test&gt;
  </code></pre>
  
  <p>Should both validate. While:</p>
  
  <pre><code>&lt;test&gt;&lt;B&gt;BAZ&lt;/B&gt;&lt;/test&gt;
  </code></pre>
  
  <p>Should NOT validate. However, I am getting from xsd:</p>
  
  <pre><code>cos-element-consistent: Error for type 'typeBroken'. Multiple elements with name 'B', with different types, appear in the model group.
  </code></pre>