title: SAXParseException code cvc-elt.1 for given xsd/ xml
body: <p>I have a given xsd file and given examples for this file. the xsd is very similar to <a href="http://www.forum-datenaustausch.ch/hospitalinvoicerequest_400.xsd" rel="nofollow">http://www.forum-datenaustausch.ch/hospitalinvoicerequest_400.xsd</a> but with one additional element below the root.</p>
  
  <p>The problem is if i validate the given xml against the schema (using moxy as JAXBCOntextFactory) i got this error:</p>
  
  <pre><code>enterCaused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 221; cvc-elt.1: Cannot find the declaration of element 'invoice:request'.
  </code></pre>
  
  <p>invoice:request is the root element the xml begins:</p>
  
  <pre><code>&lt;invoice:request role="production" xmlns:invoice="http://www.medidata.ch/QO/XSD" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.medidata.ch/QO/XSD QO_MDInvoiceRequest_400.xsd"&gt;
  </code></pre>
  
  <p>If i validate the xml against the schema <a href="http://www.freeformatter.com/xml-validator-xsd.html" rel="nofollow">online</a> or in eclipse (right click validate) all works fine. And if i change the name space from</p>
  
  <pre><code>xmlns:invoice="http://www.medidata.ch/QO/XSD"
  </code></pre>
  
  <p>to</p>
  
  <pre><code>xmlns:invoice="http://www.xmlData.ch/xmlInvoice/XSD"
  </code></pre>
  
  <p>the error disappears - but i get another one because of the additional element. 
  With this name space declaration i can't even read the contents without validation: the getter for root returns null. With the alternative declaration ("<a href="http://www.xmlData.ch/xmlInvoice/XSD" rel="nofollow">http://www.xmlData.ch/xmlInvoice/XSD</a>") and without validation all works fine!</p>
  
  <p>So whats wrong with the name space declaration?</p>