I'm trying to check the validity of an XML schema using methods provided by QXmlSchema. I know from other tools (such as Eclipse or xmllint) that the schema is valid, but the outcome with the following code always results in "schema is invalid".
QFile file("/home/....xsd");
file.open(QIODevice::ReadOnly);
QXmlSchema schema;
schema.load(&file, QUrl::fromLocalFile(file.fileName()));
if ( schema.isValid() ) {
QXmlSchemaValidator validator( schema );
if ( validator.validate( QUrl("file:///......xml") ) ) {
qDebug() << "instance is valid";
} else {
qDebug() << "instance is invalid";
}
} else {
qDebug() << "schema is invalid";
}
The error logged is something like:
Error XSDError in file:///home/......xsd, at line X, column Y: Content model of complex type foo is not a valid extension of content model of bar.
I wonder if this has to do with the Schema namespace imports or what else.
EDIT: The schema I'm referring to is this one.