//get file from test data QString input_xml_file_path = UnitTestsUtilities::CONVERSION_TEST_DATA_DIR + "Qt_bug.xml"; QString input_xml_schema_path = UnitTestsUtilities::CONVERSION_TEST_DATA_DIR + "Qt_bug_schema.xsd"; QFile input_file(input_xml_file_path); Assert::IsTrue(input_file.open(QIODevice::ReadOnly | QIODevice::Text)); QByteArray input_xml = input_file.readAll(); QFile schema_file(input_xml_schema_path); const QByteArray schema_file_string(schema_file.open(QFile::ReadOnly) ? schema_file.readAll() : ""); schema_file.close(); QXmlSchema schema; Assert::IsTrue(schema.load(schema_file_string) && schema.isValid()); // we have a valid schema - let's validate the xml QXmlSchemaValidator validator(schema); bool result = validator.validate(input_xml); Assert::IsTrue(result);