title: XML Schema Multiple Element Occurances
body: <p>I am trying to develop an XML schema.  It is for a survey, and example XML could look as follows.</p>
  
  <pre><code>&lt;survey&gt;
    &lt;instructions&gt;Please complete the survey.&lt;/instructions&gt;
    &lt;section&gt;
      &lt;sectionHeader&gt;Multiple Choice: Select the most appropriate answer.&lt;/sectionHeader&gt;
      &lt;item&gt;
        &lt;question&gt;What is your favorite color?&lt;/question&gt;
        &lt;answer&gt;
          &lt;option&gt;red&lt;/option&gt;
          &lt;option&gt;yellow&lt;/option&gt;
          &lt;option&gt;blue&lt;/option&gt;
        &lt;/answer&gt;
      &lt;/item&gt;
      &lt;item&gt;
        &lt;question&gt;What is your favorite shape?&lt;/question&gt;
        &lt;answer&gt;
          &lt;option&gt;circle&lt;/option&gt;
          &lt;option&gt;square&lt;/option&gt;
          &lt;option&gt;triangle&lt;/option&gt;
        &lt;/answer&gt;
      &lt;/item&gt;
    &lt;/section&gt;
    &lt;section&gt;
      &lt;sectionHeader&gt;Free Response: Type a Response&lt;/sectionHeader&gt;
      &lt;item&gt;
        &lt;question&gt;Who is your idol and why?&lt;/question&gt;
        &lt;answer&gt;
          &lt;textbox&gt;Type your answer here.&lt;/textbox&gt;
        &lt;/answer&gt;
      &lt;/item&gt;
    &lt;section&gt;
  &lt;/survey&gt;
  </code></pre>
  
  <p>Basically, an answer can either contain one or more options, or a single text box.  Also the survey must contain one or more sections, each of which can contain one or more items.  I currently have the following xml schema.</p>
  
  <pre><code>&lt;xs:element name="survey"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:element name="instructions" type="xs:string"/&gt;
      &lt;xs:element name="section"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:element name="sectionHeader" type="xs:string"/&gt;
          &lt;xs:element name="item"/&gt;
            &lt;xs:complexType&gt;
              &lt;xs:element name="question" type="xs:string"/&gt;
              &lt;xs:element name="answer"&gt;
                ?? Choice between multiple options or one text box ??
              &lt;/xs:element&gt;
            &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>This however, only allows for one section and one item.  I want to have it allow one or more of these tags in sequence.  Also I want the answer tag to contain one or more options or a single textbox.  How can I do this?</p>