title: QXmlSchema and QXmlSchemaValidator give an error when XSD and XML are both validated
body: <p>I'm trying to validate a XML with a XSD schema in Qt.</p>
  
  <p>XML and XSD seems to be valid, according to <a href="http://www.utilities-online.info/xsdvalidation/?save=4d575ec5-5b03-4e3d-bc4a-33de599f6192-xsdvalidation#.XGp2GHdFws0" rel="nofollow noreferrer">W3C schema validator</a>.</p>
  
  <p>This is the code where I perform the validations:</p>
  
  <pre><code>bool XMLFOMParser::isWellFormed(const std::string&amp; text) const {
    QXmlSchema schema;
    bool ok = schema.load(QByteArray(SOMSchema_xsd));
    std::cout&lt;&lt; SOMSchema_xsd &lt;&lt; std::endl &lt;&lt; "--------------" &lt;&lt; std::endl;
    std::cout &lt;&lt; text &lt;&lt; std::endl &lt;&lt; "---------------" &lt;&lt; std::endl;
    QXmlSchemaValidator validator(schema);
    bool result = validator.validate(QByteArray(text.data()));
    return result;
  }
  </code></pre>
  
  <p><code>text</code> contains the XML text that must be validates. <code>SOMSchema_xsd</code> contains the xsd schema text.</p>
  
  <p>When I load the schema into <code>QXmlSchema</code> the variable <code>ok</code> is true, and with the <code>cout</code> I can see that both schema and xml are loaded correctly. I see entirely them.</p>
  
  <p>When I perform the validation, <code>result</code> is false, and in de console I can see following messages:</p>
  
  <pre><code>Error XSDError in http://standards.ieee.org/downloads/1516/1516.2-2010/IEEE1516-DIF-2010.xsd, at line 1, column 0: Premature end of document.
  Error XSDError in file:///my/program.exe, at line 2, column 251: Loaded schema file is invalid.
  </code></pre>
  
  <p>I don't know why I'm obtaining these errors since:</p>
  
  <ul>
  <li>Files are loaded correctly into classes (I can see them with the <code>cout</code>);</li>
  <li><code>QXmlSchema</code> gives me no errors when the xsd is loaded</li>
  <li>The W3C site says to me that XML is validated with no problems.</li>
  </ul>
  
  <p>What I'm doing wrong?</p>