Hi everybody,

I'm using Qt 5 with VS 2012.
I'm trying to validate the .xsd file : musicxml.xsd that you can download here :

http://www.musicxml.com/for-developers/musicxml-xsd/

The code is :

Code:
static bool initMusicXmlSchema(QXmlSchema& schema)
      {
      // read the MusicXML schema from the application resources
      QFile schemaFile("schema/musicxml.xsd");
    
      if (!schemaFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
            return false;
            }

      // copy the schema into a QByteArray and fixup xs:imports,
      // using a path to the application resources instead of to www.musicxml.org
      // to prevent downloading from the net
      QByteArray schemaBa;
      QTextStream schemaStream(&schemaFile);
      while (!schemaStream.atEnd()) {
            QString line = schemaStream.readLine();
            if (line.contains("xs:import"))
                  line.replace("http://www.musicxml.org/xsd", "qrc:///schema");
            schemaBa += line.toUtf8();
            schemaBa += "\n";
            }

      // load and validate the schema
      schema.load(schemaBa);
       if (!schema.isValid()) {
            return false;
            }

      return true;
      }
We can state that the xsd file is valid : I loaded it into many softwares sus as XML Liquid Studio. No error.

When running the code :

- schema.isValid() always returns false
- when I put a breakpoint on the line : schema.load ... and then I step over (F10) I get an exception
- when I delete this breakpoint ant put another one on the line if (!schema.isValid()) I don't have any exception but isValid always returns false

I tried with other .xsd files from the xml music website : xlink.xsd and xml.xsd. They are smaller than musicxml.xsd and are seen valid by IsValid.
I tried also a larger file : xsd file from collada 3D file format. It always throws an exception while loading.

Is there any mistake in the code or is it a bug within Qt ?

Many thanks for your help !