Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 08be5cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/providers/wfs/qgswfscapabilities.cpp
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfscapabilities.h
Expand Up @@ -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; }

Expand Down

0 comments on commit 08be5cd

Please sign in to comment.