WSL/SLF GitLab Repository

Commit 2ea828ef authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Removing all dependencies to QtXmlPatterns for compatibility with Qt6

This is issue 887 and is unfortunately required in order to compile on Apple Arm
silicon...
parent f2e2ed87
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <src/main/inishell.h> #include <src/main/inishell.h>
#include <QCoreApplication> //for translations #include <QCoreApplication> //for translations
#include <QtXmlPatterns/QXmlSchema>
#include <QtXmlPatterns/QXmlSchemaValidator>
/** /**
* @class XMLReader * @class XMLReader
...@@ -87,7 +85,6 @@ QString XMLReader::read(QFile &file, QString &xml_error, const bool &no_referenc ...@@ -87,7 +85,6 @@ QString XMLReader::read(QFile &file, QString &xml_error, const bool &no_referenc
return QString(); return QString();
parseIncludes(xml_, master_xml_file_, xml_error); //"<include file='...'/>" tags parseIncludes(xml_, master_xml_file_, xml_error); //"<include file='...'/>" tags
validateSchema(xml_error);
parseReferences(); //"<reference name='...'/>" tags parseReferences(); //"<reference name='...'/>" tags
return parseAutoloadIni(); return parseAutoloadIni();
} }
...@@ -259,31 +256,3 @@ QDomDocument XMLReader::getXml() const ...@@ -259,31 +256,3 @@ QDomDocument XMLReader::getXml() const
return xml_; return xml_;
} }
/**
* @brief Perform schema validation on an XML file.
* @param[out] xml_error XML operations error string to add to.
*/
void XMLReader::validateSchema(QString &xml_error) const
{
/*
* The logger already displays a lot of info and the XML parser itself also logs errors,
* but what it doesn't do is check for outdated parameter names, unknown attributes, etc.,
* so the schema validation is still useful.
*/
MessageHandler msgHandler;
QXmlSchema schema;
schema.setMessageHandler(&msgHandler);
schema.load( QUrl("qrc:config_schema.xsd") );
if (!schema.isValid()) {
xml_error += QCoreApplication::tr("XML error: there is an error in the internal xsd file. Skipping schema validation.") + "\n";
} else {
const QXmlSchemaValidator validator(schema);
const bool validation_success = validator.validate(xml_.toString().toUtf8());
if (!validation_success) {
QTextDocument error_msg;
error_msg.setHtml(msgHandler.status()); //strip HTML
xml_error += "[XML error: schema validation failed] " + error_msg.toPlainText() +
QString(" (line %1, column %2)").arg(msgHandler.line(), msgHandler.column()) + "\n";
}
}
}
...@@ -62,8 +62,6 @@ class XMLReader { ...@@ -62,8 +62,6 @@ class XMLReader {
#endif //def DEBUG #endif //def DEBUG
private: private:
void validateSchema(QString &xml_error) const;
QString master_xml_file_; QString master_xml_file_;
QDomDocument xml_; QDomDocument xml_;
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment