title: Why does XSD say my element is not complete?
body: <p>I have an XSD of this form:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.example.org/example"
      xmlns:tns="http://www.example.org/example" elementFormDefault="qualified"&gt;
  
      &lt;complexType name="bType"&gt;
      &lt;/complexType&gt;
  
      &lt;complexType name="aType"&gt;
          &lt;choice maxOccurs="unbounded"&gt;
              &lt;element name="a" type="tns:aType" /&gt;
              &lt;element name="b" type="tns:bType" /&gt;
          &lt;/choice&gt;
      &lt;/complexType&gt;
  
      &lt;element name="topelement"&gt;
          &lt;complexType&gt;
              &lt;sequence&gt;
                  &lt;element name="a" type="tns:aType" maxOccurs="1" /&gt;
              &lt;/sequence&gt;
          &lt;/complexType&gt;
      &lt;/element&gt;
  &lt;/schema&gt;
  </code></pre>
  
  <p>And an XML file that I expect to match it, e.g:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;topelement xmlns="http://www.example.org/example"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.example.org/example example.xsd "&gt;
    &lt;a&gt; &lt;!-- Error on this line. --&gt;
      &lt;a/&gt;
      &lt;b/&gt;
      &lt;b/&gt;
      &lt;a/&gt;
    &lt;/a&gt;
  &lt;/topelement&gt;
  </code></pre>
  
  <p>Unfortunately the XSD says that this is not valid with the following error:</p>
  
  <pre><code>cvc-complex-type.2.4.b: The content of element 'a' is not complete. One of '{"http://www.example.org/example":a, "http://www.example.org/example":b}' is expected.  example.xml line 5
  </code></pre>
  
  <p>As far as I can tell, I've done everything I need to do for the tag to be complete. I've filled it with an unbounded choice of 'a' and 'b' tags. Can anyone see what's gone wrong?</p>
  
  <p>To clarify, I want there to be only one 'a' tag under topelement, and underneath that, a mix of 'a' and 'b' tags.</p>