I am using QXmlSchemaValidator to validate my xml against different xsds.
My code is as follows:
bool MyClass::verify(QByteArray message)
{
bool successfulValidated = false;
for(QByteArray& xsd: _xsds)
{
QXmlSchema schema;
schema.load(xsd);
if(!schema.isValid())
throw Exception("schema not valid");
QXmlSchemaValidator msgValidator(schema);
if(msgValidator.validate(message))
{
successfulValidated = true;
break;
}
}
return successfulValidated;
}
If msgValidator.validate(message) is false I get and application output like
Error XSDError in file:///MyApplication.exe, at line 1, column 47: No definition for element MyXMLElement available.
I do not want these application output messages as they clutter my output window. Is there any way that I can either suppress these messages or handle them myself?
In case anyone has the same problem:
Just add your own
MessageHandlerto theQXmlSchemaas described in this Topic.