title: How to define elements in xsd as mandatory/optional and any order
body: <p>I am unable to define the elements with <code>&lt;xsd:all&gt;</code> for below requirement,</p>
  
  <p>I am getting error that <code>maxOccursv should be 0 or 1 under schema</code>all`.</p>
  
  <p>Below is my requirement, could anyone please help me as soon as possible.</p>
  
  <ol>
  <li>elements (<code>A</code> &amp; <code>B</code>) can come in any order in xml (so i am using <code>xsd:all</code>, but gettting error), i don't want to go with sequence.</li>
  <li>element <code>A</code> is mandatory, it should appear in xml always, however element <code>B</code> is optional.</li>
  <li>element <code>A</code> &amp; <code>B</code> can appear any number of times for example I can have element <code>A</code> 10 times and element <code>B</code> 20 times.</li>
  </ol>
  
  <hr>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xsd:element name="InvoiceData"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:all&gt;
                  &lt;xsd:element name="A" minOccurs="1" maxOccurs="unbounded" &gt;
                  &lt;xsd:element name="B" minOccurs="0" maxOccurs="unbounded" &gt;
              &lt;/xsd:all&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>