mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
fix(WMSGetMap): fix Qt6 filter read
Since Qt6 Undeclared namespace prefixes are no longer allowed (see https://doc.qt.io/qt-6/xml-changes-qt6.html#qdom-and-qdomdocument), we need to define fes filter in case it would be empty.
This commit is contained in:
parent
3602011132
commit
f9852e84d7
@ -78,6 +78,7 @@
|
||||
#include <QTemporaryFile>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <QXmlStreamReader>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
//for printing
|
||||
@ -3558,10 +3559,20 @@ namespace QgsWms
|
||||
// OGC filter
|
||||
QDomDocument filterXml;
|
||||
QString errorMsg;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 5, 0 )
|
||||
if ( !filterXml.setContent( filter.mFilter, true, &errorMsg ) )
|
||||
{
|
||||
throw QgsBadRequestException( QgsServiceException::QGIS_InvalidParameterValue, QStringLiteral( "Filter string rejected. Error message: %1. The XML string was: %2" ).arg( errorMsg, filter.mFilter ) );
|
||||
}
|
||||
#else
|
||||
QXmlStreamReader xmlReader( filter.mFilter );
|
||||
xmlReader.addExtraNamespaceDeclaration( QXmlStreamNamespaceDeclaration( QStringLiteral( "fes" ), QStringLiteral( "http://www.opengis.net/fes/2.0" ) ) );
|
||||
if ( QDomDocument::ParseResult result = filterXml.setContent( &xmlReader, QDomDocument::ParseOption::UseNamespaceProcessing ); !result )
|
||||
{
|
||||
throw QgsBadRequestException( QgsServiceException::QGIS_InvalidParameterValue, QStringLiteral( "Filter string rejected. Error %1:%2 : %3. The XML string was: %4" ).arg( QString::number( result.errorLine ), QString::number( result.errorColumn ), result.errorMessage, filter.mFilter ) );
|
||||
}
|
||||
#endif
|
||||
QDomElement filterElem = filterXml.firstChildElement();
|
||||
std::unique_ptr<QgsExpression> filterExp( QgsOgcUtils::expressionFromOgcFilter( filterElem, filter.mVersion, filteredLayer ) );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user