title: Why is the contained element name not validated when validating an xml file against multiple xsd files using eclipse?
body: <p>I am authoring xml schemas using eclipse and I have small problem with validation.</p>
  
  <p>I have two schemas and an xml file.</p>
  
  <p>Main.xsd:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.example.org/Main"
      xmlns:tns="http://www.example.org/Main"
      elementFormDefault="qualified"&gt;
  
      &lt;complexType name="mainType"&gt;
          &lt;sequence&gt;
              &lt;any namespace="##other" processContents="lax" /&gt;
          &lt;/sequence&gt;
      &lt;/complexType&gt;
  
      &lt;element name="main" type="tns:mainType" /&gt;
  &lt;/schema
  </code></pre>
  
  <p>Sub.xsd:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.example.org/Sub"
      xmlns:tns="http://www.example.org/Sub"
      elementFormDefault="qualified"&gt;
  
      &lt;complexType name="subType"&gt;
          &lt;attribute name="name" type="string"
              use="required" /&gt;
      &lt;/complexType&gt;
  
      &lt;element name="sub" type="tns:subType" /&gt;
  &lt;/schema&gt;
  </code></pre>
  
  <p>Sample.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;tns:main xmlns:tns="http://www.example.org/Main"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:sub="http://www.example.org/Sub"
      xsi:schemaLocation="
          http://www.example.org/Main Main.xsd 
          http://www.example.org/Sub Sub.xsd"&gt;
      &lt;sub:sub name="test" /&gt;
  &lt;/tns:main&gt;
  </code></pre>
  
  <p>If I change the name attribute of the sub element then the validation fails as expected:</p>
  
  <p><a href="https://i.stack.imgur.com/QynWG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QynWG.png" alt="Validation fails as expected"></a></p>
  
  <p>But if I change the element name of the sub element then the validation succeeds:</p>
  
  <p><a href="https://i.stack.imgur.com/BX52Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BX52Z.png" alt="Validation succeeds"></a></p>
  
  <p>I expected this validation to fail too. What is it not?</p>