title: No declaration found for element
body: <p>I have a simple XML and XSD files. I am using Xerces to generate .h/cpp files but when I run the application it gives an error:</p>
  
  <blockquote>
    <p>no declaration found for element 'x:books'</p>
  </blockquote>
  
  <p>My XML file is:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;x:books xmlns:x="urn:books"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:BookStore books.xsd"&gt;
  
     &lt;book id="bk001"&gt;
        &lt;author&gt;Writer&lt;/author&gt;
        &lt;title&gt;The First Book&lt;/title&gt;
        &lt;genre&gt;Fiction&lt;/genre&gt;
        &lt;price&gt;44.95&lt;/price&gt;
        &lt;pub_date&gt;2000-10-01&lt;/pub_date&gt;
        &lt;review&gt;An amazing story of nothing.&lt;/review&gt;
     &lt;/book&gt;
  
     &lt;book id="bk002"&gt;
        &lt;author&gt;Poet&lt;/author&gt;
        &lt;title&gt;The Poet's First Poem&lt;/title&gt;
        &lt;genre&gt;Poem&lt;/genre&gt;
        &lt;price&gt;24.95&lt;/price&gt;
        &lt;pub_date&gt;2001-10-01&lt;/pub_date&gt;
        &lt;review&gt;Least poetic poems.&lt;/review&gt;
     &lt;/book&gt;
  &lt;/x:books&gt;
  </code></pre>
  
  <p>and XSD file is:</p>
  
  <pre><code>&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              targetNamespace="urn:BookStore"
              xmlns:bks="urn:BookStore"&gt;
  
    &lt;xsd:element name="books" type="bks:BooksForm"/&gt;
  
    &lt;xsd:complexType name="BooksForm"&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="book" 
                    type="bks:BookForm" 
                    minOccurs="0" 
                    maxOccurs="unbounded"/&gt;
        &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
  
    &lt;xsd:complexType name="BookForm"&gt;
      &lt;xsd:sequence&gt;
        &lt;xsd:element name="author"   type="xsd:string"/&gt;
        &lt;xsd:element name="title"    type="xsd:string"/&gt;
        &lt;xsd:element name="genre"    type="xsd:string"/&gt;
        &lt;xsd:element name="price"    type="xsd:float" /&gt;
        &lt;xsd:element name="pub_date" type="xsd:date" /&gt;
        &lt;xsd:element name="review"   type="xsd:string"/&gt;
      &lt;/xsd:sequence&gt;
      &lt;xsd:attribute name="id"   type="xsd:string"/&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>I have done a simpler demo with Xerces but this one uses namespaces and I think that seems to causing the trouble.</p>