Skip to content
Permalink
Browse files
Test WFS version and throw error if 1.0 is not supported by the server
  • Loading branch information
mhugent committed Jan 4, 2013
1 parent 462d8a8 commit 08be5cd83709646e5119fc329612b9c66b0cf214
Showing with 11 additions and 1 deletion.
  1. +10 −0 src/providers/wfs/qgswfscapabilities.cpp
  2. +1 −1 src/providers/wfs/qgswfscapabilities.h
@@ -203,6 +203,16 @@ void QgsWFSCapabilities::capabilitiesReplyFinished()

mCaps.clear();

//test wfs version
QString version = capabilitiesDocument.documentElement().attribute( "version" );
if ( version != "1.0.0" && version != "1.0" )
{
mErrorCode = WFSVersionNotSupported;
mErrorMessage = tr( "The WFS server does not support WFS version 1.0" );
emit gotCapabilities();
return;
}

// get the <FeatureType> elements
QDomNodeList featureTypeList = capabilitiesDocument.elementsByTagNameNS( WFS_NAMESPACE, "FeatureType" );
for ( unsigned int i = 0; i < featureTypeList.length(); ++i )
@@ -65,7 +65,7 @@ class QgsWFSCapabilities : public QObject
QList<FeatureType> featureTypes;
};

enum ErrorCode { NoError, NetworkError, XmlError, ServerExceptionError };
enum ErrorCode { NoError, NetworkError, XmlError, ServerExceptionError, WFSVersionNotSupported };
ErrorCode errorCode() { return mErrorCode; }
QString errorMessage() { return mErrorMessage; }

0 comments on commit 08be5cd

Please sign in to comment.