title: XML schema for elements with same name but different sub-structure depending on context
body: <p>I try to define a schema for XML documents I receive.</p>
  
  <p>The documents look like:</p>
  
  <pre><code>&lt;root&gt;
      &lt;items&gt;
          &lt;group name="G-1"&gt;
              &lt;item name="I-1"/&gt;
              &lt;item name="I-2"/&gt;
              &lt;item name="I-3"/&gt;
              &lt;item name="I-4"/&gt;
          &lt;/group&gt;
      &lt;/items&gt;
      &lt;data&gt;
          &lt;group name="G-1" place="here"&gt;
              &lt;customer name="C-1"&gt;
                  &lt;item name="I-1" count="3"/&gt;
                  &lt;item name="I-2" count="4"/&gt;
              &lt;/customer&gt;
              &lt;customer name="C-2"&gt;
                  &lt;item name="I-3" count="7"/&gt;
              &lt;/customer&gt;
          &lt;/group&gt;
      &lt;/data&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I tried XmlSpy and xsd.exe from .NET 2.0. Both created schema definitions which allow below <code>&lt;group&gt;</code> any number of <code>&lt;item&gt;</code> and <code>&lt;customer&gt;</code> elements. But what I'm looking for should restrict <code>&lt;group&gt;</code> below <code>&lt;items&gt;</code> to <code>&lt;item&gt;</code> elements, and <code>&lt;group&gt;</code> below <code>&lt;data&gt;</code> to <code>&lt;customer&gt;</code> elements.</p>
  
  <p>Is this something xml schema is not capable at all?</p>