title: XSD none, one, or both
body: <p>I searched a whole bunch and couldn't find any questions similar to this before posting. I'm working on creating an XSD and one complexType has these requirements:</p>
  
  <ul>
  <li>The element can have neither field</li>
  <li>The element can have field one </li>
  <li>If the element has field two it must also have field one</li>
  </ul>
  
  <p>It essentially works out to "none, one(but a specific one), or both" but I can't figure out what I'm doing incorrectly and any help would be appreciated</p>
  
  <pre><code>&lt;xs:complexType name="Foo"&gt;
      &lt;xs:choice minOccurs="0"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="fieldOne" maxOccurs="1"/&gt;
          &lt;/xs:sequence&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="fieldOne" maxOccurs="1"/&gt;
              &lt;xs:element name="fieldTwo" maxOccurs="1"/&gt;             
          &lt;/xs:sequence&gt;
      &lt;/xs:choice&gt;
  &lt;/xs:complexType&gt;
  </code></pre>