22
22
#include " qgswfsutils.h"
23
23
#include " qgsserverprojectutils.h"
24
24
#include " qgswfsdescribefeaturetype.h"
25
+ #include " qgswfsparameters.h"
25
26
26
27
#include " qgsproject.h"
27
28
#include " qgsexception.h"
@@ -53,6 +54,13 @@ namespace QgsWfs
53
54
QDomDocument doc;
54
55
55
56
QgsServerRequest::Parameters parameters = request.parameters ();
57
+ QgsWfsParameters wfsParameters ( parameters );
58
+ QgsWfsParameters::Format oFormat = wfsParameters.outputFormat ();
59
+
60
+ // test oFormat
61
+ if ( oFormat == QgsWfsParameters::Format::NONE )
62
+ throw QgsBadRequestException ( QStringLiteral ( " Invalid WFS Parameter" ),
63
+ " OUTPUTFORMAT " + wfsParameters.outputFormatAsString () + " is not supported" );
56
64
57
65
QgsAccessControl *accessControl = serverIface->accessControls ();
58
66
@@ -71,7 +79,10 @@ namespace QgsWfs
71
79
// xsd:import
72
80
QDomElement importElement = doc.createElement ( QStringLiteral ( " import" )/* xsd:import*/ );
73
81
importElement.setAttribute ( QStringLiteral ( " namespace" ), GML_NAMESPACE );
74
- importElement.setAttribute ( QStringLiteral ( " schemaLocation" ), QStringLiteral ( " http://schemas.opengis.net/gml/2.1.2/feature.xsd" ) );
82
+ if ( oFormat == QgsWfsParameters::Format::GML2 )
83
+ importElement.setAttribute ( QStringLiteral ( " schemaLocation" ), QStringLiteral ( " http://schemas.opengis.net/gml/2.1.2/feature.xsd" ) );
84
+ else if ( oFormat == QgsWfsParameters::Format::GML3 )
85
+ importElement.setAttribute ( QStringLiteral ( " schemaLocation" ), QStringLiteral ( " http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" ) );
75
86
schemaElement.appendChild ( importElement );
76
87
77
88
QStringList typeNameList;
0 commit comments