title: XML Schema - how to define an element that contains a string or child elements
body: <p>I need to define a XML schema. The result should look like this:</p>
  
  <pre><code>&lt;option value="priority"&gt;4&lt;/option&gt;
  &lt;option value="values"&gt;
      &lt;value name="x86-32" lang="en-GB" group="root"&gt;x86 32-Bit&lt;/value&gt;
      &lt;value name="x86-64" lang="en-GB" group="root"&gt;x86 64-Bit&lt;/value&gt;
      &lt;value name="ARM" lang="en-GB" group="root"&gt;ARM&lt;/value&gt;
      &lt;value name="PowerPC" lang="en-GB" group="root"&gt;PowerPC&lt;/value&gt;
      &lt;value name="SPARC" lang="en-GB" group="root"&gt;SPARC&lt;/value&gt;
      &lt;value name="PA-RISC" lang="en-GB" group="root"&gt;PA-RISC&lt;/value&gt;
      &lt;value name="DEC-Alpha" lang="en-GB" group="root"&gt;DEC Alpha&lt;/value&gt;
  &lt;/option&gt;
  &lt;option value="editable"&gt;true&lt;/option&gt;
  </code></pre>
  
  <p>So the element "option" contains either a string or set of child elements with strings.
  I have tried something like this:</p>
  
  <pre><code>&lt;xs:element name="options" minOccurs="0"  maxOccurs="1"&gt;
      &lt;xs:complexType mixed="true"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="option" maxOccurs="unbounded"&gt;
                  &lt;xs:complexType&gt;
                      &lt;xs:simpleContent&gt;
                          &lt;xs:extension base="xs:string"&gt;                              
                              &lt;xs:attribute name="value" use="required" type="xs:string" /&gt;
                          &lt;/xs:extension&gt;
                      &lt;/xs:simpleContent&gt;
                  &lt;/xs:complexType&gt;
              &lt;/xs:element&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;                       
  </code></pre>
  
  <p>But the validator doesn't allow this definition: </p>
  
  <blockquote>
    <p>cvc-complex-type.2.2: Element 'option'
    must have no element [children], and
    the value must be valid.</p>
  </blockquote>
  
  <p>Any idea how to solve it?</p>
  
  <p>Best regards,
  Radek</p>