title: Qt - How validate a xml file with xsd file which imports another xsd file?
body: <p>I use this code to validate my <code>foo.xml</code></p>
  
  <blockquote>
  <pre><code>QFile* fileXsd = new QFile("D:\\...\\fooValidator.xsd");
  if (!fileXsd-&gt;open(QIODevice::ReadOnly | QIODevice::Text))
      qWarning() &lt;&lt; QObject::tr("Couldn't open xsd file.");    
  QXmlSchema schema;
  schema.load(fileXsd);
  if(schema.isValid()) 
  {
      QFile* fileXml = new QFile("D:\\...\\foo.xml");
      if (!fileXml-&gt;open(QIODevice::ReadOnly | QIODevice::Text))
          qWarning() &lt;&lt; QObject::tr("Couldn't open xml file.");
      QXmlSchemaValidator validator(schema);
      if(!validator.validate(fileXml, QUrl::fromLocalFile(fileXml-&gt;fileName())))
          qCritical() &lt;&lt; "instance document is invalid";
      else
      {
          //Ok
      }
   }
  </code></pre>
  </blockquote>
  
  <p>My file <code>fooValidator.xsd</code> imports types from a file <code>fooTypeValidator.xsd</code>.</p>
  
  <p><code>fooValidator.xsd</code>, <code>fooTypeValidator.xsd</code> and <code>foo.xml</code> are correct (I verrified with  <a href="http://www.xmlvalidation.com" rel="nofollow">xmlvalidation</a>)</p>
  
  <p>When I run my program, I get an error ; the type declared in <code>fooTypeValidator.xsd</code> cannot be resolved.</p>
  
  <p><code>fooTypeValidator.xsd</code> is not imported by <code>QXmlSchema</code> nor by <code>QXmlSchemaValidator</code></p>