title: XML + Schema + Namespaces. No matching global declaration available for the validation root
body: <p>What is the correct syntax when referring to schema when using namespaces?</p>
  
  <p><strong>Problem</strong></p>
  
  <p>Creating an XML document using a given schema.</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>
      .xml:9.20: Element '{http://example/buildings/1.0}old_buildings': No matching global declaration available for the validation root.
      oldbuildings.xml - invalid
      Problem
  </code></pre>
  
  <p><strong>XML Document</strong>
  <pre><code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;buildings:old_buildings xmlns:buildings="http://example/buildings/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://example/buildings/1.0 oldbuildings_schema.xsd"&gt;
      &lt;building&gt;
          &lt;name&gt;Name&lt;/name&gt;
          &lt;year_built era="BC"&gt;2000&lt;/year_built&gt;
          &lt;story&gt;...&lt;story&gt;
      &lt;/building&gt;
  &lt;/buildings:old_buildings&gt;
  </code></pre>
  
  <p></pre></code></p>
  
  <p><strong>XSD Document</strong></p>
  
  <pre>
  
      &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
      &lt;xs:schema targetNamespace="http://example/buildings/1.0/" <br>xmlns:xs="http://www.w3.org/2001/XMLSchema" <br>xmlns="http://example/buildings/1.0/"&gt;
          &lt;xs:element name="old_buildings"&gt;
              &lt;xs:complexType&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="building"/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
  
          &lt;xs:element name="building" type="buildingType"&gt;&lt;/xs:element&gt;
  
  
          &lt;xs:complexType name="buildingType"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="name" type="xs:string"/&gt;
                  &lt;xs:element name="year_built" type="yearType"/&gt;
                  &lt;xs:element name="story" type="xs:string"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
          &lt;xs:complexType name="yearType"&gt;
              &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:positiveInteger"&gt;
                      &lt;xs:attribute name="era" type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
              &lt;/xs:simpleContent&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:schema&gt;
  
  </pre>