"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/server/services/wms/qgswmsgetschemaextension.cpp" between
QGIS-final-3_10_5.tar.gz and QGIS-final-3_10_6.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Long-term release (3.10.x series).

qgswmsgetschemaextension.cpp  (QGIS-final-3_10_5):qgswmsgetschemaextension.cpp  (QGIS-final-3_10_6)
skipping to change at line 27 skipping to change at line 27
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include "qgswmsutils.h" #include "qgswmsutils.h"
#include "qgswmsgetschemaextension.h" #include "qgswmsgetschemaextension.h"
#include "qgsapplication.h" #include "qgsapplication.h"
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QTextStream>
namespace QgsWms namespace QgsWms
{ {
void writeGetSchemaExtension( QgsServerInterface *serverIface, const QString & void writeGetSchemaExtension( QgsServerResponse &response )
version,
const QgsServerRequest &request, QgsServerRespon
se &response )
{ {
QDomDocument doc = getSchemaExtension( serverIface, version, request );
response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/
xml; charset=utf-8" ) );
response.write( doc.toByteArray() );
}
QDomDocument getSchemaExtension( QgsServerInterface *serverIface, const QStrin
g &version,
const QgsServerRequest &request )
{
Q_UNUSED( version )
Q_UNUSED( serverIface )
QgsServerRequest::Parameters parameters = request.parameters();
QDomDocument xsdDoc;
QDir resourcesDir = QFileInfo( QgsApplication::serverResourcesPath() ).absol uteDir(); QDir resourcesDir = QFileInfo( QgsApplication::serverResourcesPath() ).absol uteDir();
QFileInfo xsdFileInfo( resourcesDir, QStringLiteral( "schemaExtension.xsd" ) ); QFileInfo xsdFileInfo( resourcesDir, QStringLiteral( "schemaExtension.xsd" ) );
QString schema_str = QStringLiteral( "<?xml version='1.0'?>" );
if ( !xsdFileInfo.exists() ) if ( !xsdFileInfo.exists() )
{ {
QgsMessageLog::logMessage( QStringLiteral( "Error, xsd file 'schemaExtensi on.xsd' does not exist" ), QgsMessageLog::logMessage( QStringLiteral( "Error, xsd file 'schemaExtensi on.xsd' does not exist" ),
QStringLiteral( "Server" ), Qgis::Critical ); QStringLiteral( "Server" ), Qgis::Critical );
return xsdDoc;
}
QString xsdFilePath = xsdFileInfo.absoluteFilePath();
QFile xsdFile( xsdFilePath );
if ( !xsdFile.exists() )
{
QgsMessageLog::logMessage( QStringLiteral( "Error, xsd file 'schemaExtensi
on.xsd' does not exist" ),
QStringLiteral( "Server" ), Qgis::Critical );
return xsdDoc;
}
if ( !xsdFile.open( QIODevice::ReadOnly ) )
{
QgsMessageLog::logMessage( QStringLiteral( "Error, cannot open xsd file 's
chemaExtension.xsd' does not exist" ),
QStringLiteral( "Server" ), Qgis::Critical );
return xsdDoc;
} }
else
QString errorMsg;
int line, column;
if ( !xsdDoc.setContent( &xsdFile, true, &errorMsg, &line, &column ) )
{ {
QgsMessageLog::logMessage( QStringLiteral( "Error parsing file 'schemaExte QFile file( xsdFileInfo.absoluteFilePath() );
nsion.xsd" ) + if ( file.open( QFile::ReadOnly | QFile::Text ) )
QStringLiteral( "': parse error %1 at row %2, c {
olumn %3" ).arg( errorMsg ).arg( line ).arg( column ), QTextStream in( &file );
QStringLiteral( "Server" ), Qgis::Critical ); schema_str = in.readAll();
file.close();
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Error, xsd file 'schemaExten
sion.xsd' not readable" ),
QStringLiteral( "Server" ), Qgis::Critical );
}
} }
response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/
return xsdDoc; xml; charset=utf-8" ) );
response.write( schema_str );
} }
} // namespace QgsWms } // namespace QgsWms
 End of changes. 8 change blocks. 
51 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)