title: XSD/XML - Defining elements inside elements inside [...]
body: <p>I wan't to be able to verify the following (XSD yes, I know) structure:</p>
  
  <pre><code>    &lt;Mappings&gt;
            &lt;Mapping name="foo" type="bar"&gt;a string&lt;/Mapping&gt;
            &lt;Mapping name="Model" type="TableMapping" valueformat="&gt;
               &lt;Entry expression="some expression" value="some value"/&gt;
               &lt;Entry expression="some other expression" value="some other value"/&gt;
            &lt;/Mapping&gt;
      &lt;/Mappings&gt;
  </code></pre>
  
  <p>To this end I have this schema:</p>
  
  <pre><code>&lt;xs:complexType name="Mappings"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="Mapping" maxOccurs="unbounded" minOccurs="1"&gt;
              &lt;xs:complexType&gt;
                  &lt;xs:simpleContent&gt;
                      &lt;xs:extension base="xs:string"&gt;
                          &lt;xs:attribute type="xs:string" name="name"/&gt;
                          &lt;xs:attribute type="AllowedMappingTypes" name="type"/&gt;
                          &lt;xs:attribute type="xs:string" name="valueformat"/&gt;
                      &lt;/xs:extension&gt;
                  &lt;/xs:simpleContent&gt;
  
                  &lt;xs:element name="Entry" maxOccurs="unbounded" minOccurs="1"&gt;
                      &lt;xs:simpleContent&gt;
                          &lt;xs:extension base="xs:string"&gt;
                              &lt;xs:sequence&gt;
                                  &lt;xs:attribute type="xs:string" name="expression"/&gt;
                                  &lt;xs:attribute type="xs:string" name="value"/&gt;
                              &lt;/xs:sequence&gt;
                          &lt;/xs:extension&gt;
                      &lt;/xs:simpleContent&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I.e. the Mapping elements COULD have Entry elements in them, but this is not necessary. validation fails with formatting errors :</p>
  
  <pre><code>XMLSchemaParseError: Element'{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))., line 121
  </code></pre>
  
  <p>Which is this line:</p>
  
  <pre><code> &lt;xs:element name="Entry" maxOccurs="unbounded" minOccurs="1"&gt;
  </code></pre>
  
  <p>So my question is; how do I correctly write the XSD to be able to have a Mapping with a list of attributes and an optional Entry which has some specific attributes? I believe this is probably something easy but I'm lacking.. Tried reorganizing tags and trying different ones but it didn't work. 
  Regards</p>