Don't use XERCES_CPP_NAMESPACE_USE macro.

This commit is contained in:
Roman Telezhynskyi 2023-02-20 13:03:11 +02:00
parent edccf99f43
commit 4f2f05fe9a
4 changed files with 18 additions and 18 deletions

View File

@ -190,11 +190,12 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
if (tempSchema->open())
{
XercesDOMParser domParser;
XERCES_CPP_NAMESPACE::XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr)
tempSchema->fileName().toUtf8().constData(),
XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
{
VException e(parserErrorHandler.StatusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
@ -211,7 +212,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
throw e;
}
domParser.setValidationScheme(XercesDOMParser::Val_Always);
domParser.setValidationScheme(XERCES_CPP_NAMESPACE::XercesDOMParser::Val_Always);
domParser.setDoNamespaces(true);
domParser.setDoSchema(true);
domParser.setValidationConstraintFatal(true);

View File

@ -91,30 +91,30 @@ auto VParserErrorHandler::Column() const -> XMLFileLoc
}
//---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::handleMessage(const SAXParseException &ex)
void VParserErrorHandler::handleMessage(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{
char* msg = XMLString::transcode(ex.getMessage());
char* msg = XERCES_CPP_NAMESPACE::XMLString::transcode(ex.getMessage());
m_description = QString(msg);
m_line = ex.getLineNumber();
m_column = ex.getColumnNumber();
m_hasError = true;
XMLString::release(&msg);
XERCES_CPP_NAMESPACE::XMLString::release(&msg);
}
//---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::warning(const SAXParseException &ex)
void VParserErrorHandler::warning(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{
handleMessage(ex);
}
//---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::error(const SAXParseException &ex)
void VParserErrorHandler::error(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{
handleMessage(ex);
}
//---------------------------------------------------------------------------------------------------------------------
void VParserErrorHandler::fatalError(const SAXParseException &ex)
void VParserErrorHandler::fatalError(const XERCES_CPP_NAMESPACE::SAXParseException &ex)
{
handleMessage(ex);
}

View File

@ -61,18 +61,16 @@ private:
#include <xercesc/sax/ErrorHandler.hpp>
#include <xercesc/sax/SAXParseException.hpp>
XERCES_CPP_NAMESPACE_USE
class VParserErrorHandler : public ErrorHandler
class VParserErrorHandler : public XERCES_CPP_NAMESPACE::ErrorHandler
{
public:
auto StatusMessage() const -> QString;
auto Line() const -> XMLFileLoc;
auto Column() const -> XMLFileLoc;
void warning(const SAXParseException& ex) override;
void error(const SAXParseException& ex) override;
void fatalError(const SAXParseException& ex) override;
void warning(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void error(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException& ex) override;
void resetErrors() override;
auto HasError() const -> bool;
@ -83,7 +81,7 @@ private:
QString m_description{};
bool m_hasError{false};
void handleMessage(const SAXParseException& ex);
void handleMessage(const XERCES_CPP_NAMESPACE::SAXParseException& ex);
};
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View File

@ -69,11 +69,12 @@ void ValidateSchema(const QString &schema)
if (tempSchema->open())
{
XercesDOMParser domParser;
XERCES_CPP_NAMESPACE::XercesDOMParser domParser;
domParser.setErrorHandler(&parserErrorHandler);
if (domParser.loadGrammar(
tempSchema->fileName().toUtf8().constData(), Grammar::SchemaGrammarType, true) == nullptr)
tempSchema->fileName().toUtf8().constData(),
XERCES_CPP_NAMESPACE::Grammar::SchemaGrammarType, true) == nullptr)
{
QFAIL(qUtf8Printable(QStringLiteral("%1 Could not load schema file '%2'.")
.arg(parserErrorHandler.StatusMessage(), fileSchema.fileName())));