title: Nested complexTypes in XSD returning error: Element content is not allowed, because the type definition is simple
body: <p>I'm building an xml schema for this xml:
  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;groups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:noNamespaceSchemaLocation="basic.xsd"&gt;
  &lt;!--Comienza la descripción de los grupos sencillos--&gt;
      &lt;!--modificador--&gt;
      &lt;group tagName="A"&gt;
        &lt;name&gt;modificador&lt;/name&gt;
        &lt;type&gt;simple&lt;/type&gt;
        &lt;words&gt;
          &lt;word&gt;el&lt;word&gt;
          &lt;word&gt;este&lt;word&gt;
        &lt;/words&gt;
      &lt;/group&gt;
      &lt;!--prefijos--&gt;
      &lt;group tagName="C"&gt;
        &lt;name&gt;prefijos&lt;/name&gt;
        &lt;type&gt;simple&lt;/type&gt;
        &lt;words&gt;
          &lt;word&gt;pre&lt;/word&gt;
          &lt;word&gt;ante&lt;/word&gt;
          &lt;word&gt;anti&lt;/word&gt;
          &lt;word&gt;pro&lt;/word&gt;
          &lt;word&gt;tri&lt;/word&gt;
        &lt;/words&gt;
      &lt;/group&gt;
      &lt;!--Composiciones de intérvalos--&gt;
  &lt;/groups&gt;
  </code></pre>
  
  <p>And this is my xsd file:
  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  
  &lt;!-- definition of simple elements --&gt;
  &lt;xs:element name="name" type="xs:string"/&gt;
  &lt;xs:element name="type" type="xs:string"/&gt;
  &lt;xs:element name="word" type="xs:string"/&gt; 
  
  &lt;!-- definition of attributes --&gt;
  &lt;xs:attribute name="tagName" type="xs:ID"/&gt;
  
  &lt;!-- definition of complex elements --&gt;
  &lt;xs:element name="words"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element ref="word" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  
  &lt;xs:element name="group"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element ref="name"/&gt;
        &lt;xs:element ref="type"/&gt;
        &lt;xs:element ref="words" /&gt;
      &lt;/xs:sequence&gt;
      &lt;xs:attribute ref="tagName" use="required"/&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  
  &lt;xs:element name="groups"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element ref="group" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>I'm using nokogiri to validate my xml, but I'm getting the following error:</p>
  
  <blockquote>
    <p>Element 'word': Element content is not allowed, because the type definition is simple.
    XML not schema valid</p>
  </blockquote>
  
  <p>Why should word be complex then? And how do I do that because to me it's just fine.
  Thanks in advanced.</p>