title: XML Schema Validation : Cannot find the declaration of element
body: <p>I am still a bit new to XML Schema etc. and have been working to develop some XML, Schema and a Stylesheet (XSLT). I have made reasonable progress, but then realized that my Schema had stopped working, so I have taken it back to a simpler non-descript example.</p>
  
  <p>Here is my XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="Test.Namespace"  
        schemaLocation="http://myNameSpace.com Test1.xsd"&gt;
      &lt;element1 id="001"&gt;
          &lt;element2 id="001.1"&gt;
               &lt;element3 id="001.1" /&gt;
          &lt;/element2&gt;
      &lt;/element1&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>I have written a Schema that is here:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              targetNamespace="Test.Namespace"
              elementFormDefault="qualified"&gt;
      &lt;xsd:element name="Root"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="element1" maxOccurs="unbounded" type="element1Type"/&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  
      &lt;xsd:complexType name="element1Type"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="element2" maxOccurs="unbounded" type="element2Type"/&gt;
          &lt;/xsd:sequence&gt;
          &lt;xsd:attribute name="id" type="xsd:string"/&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="element2Type"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="item" type="element3Type"/&gt;
          &lt;/xsd:sequence&gt;
          &lt;xsd:attribute name="id" type="xsd:string"/&gt;
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="element3Type"&gt;
           &lt;xsd:attribute name="id" type="xsd:string"/&gt;
      &lt;/xsd:complexType&gt;        
   &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>The Schema is representative of the structure of my real XML.</p>
  
  <p>Now, when I try to validate my XML, I get this error:</p>
  
  <p><code>cvc-elt.1: Cannot find the declaration of element 'Root'. [7]</code> </p>
  
  <p>This I think is to do with a namespace issue on the Root element, but I am really not sure.</p>
  
  <p>Can someone suggest what I am doing wrong please.</p>