adding a format to parsing OGC service exceptions (WMS 1.1 WMS 1.3 WFS 1.0 and OWSCommon 1.0 and 1.1) and hooking it up into the GetCapabilities parsers, r=tschaub (closes #2234)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12074 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-06-08 14:39:12 +00:00
parent 9d5ab38fc0
commit 2b04fd6c34
15 changed files with 505 additions and 17 deletions

View File

@@ -5,6 +5,7 @@
/**
* @requires OpenLayers/Format/WMSCapabilities.js
* @requires OpenLayers/Format/OGCExceptionReport.js
* @requires OpenLayers/Format/XML.js
*/
@@ -60,15 +61,20 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
if(typeof data == "string") {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
}
var raw = data;
if(data && data.nodeType == 9) {
data = data.documentElement;
}
var capabilities = {};
this.readNode(data, capabilities);
// postprocess the layer list
this.postProcessLayers(capabilities);
if (capabilities.service === undefined) {
// an exception must have occurred, so parse it
var parser = new OpenLayers.Format.OGCExceptionReport();
capabilities.error = parser.read(raw);
} else {
// postprocess the layer list
this.postProcessLayers(capabilities);
}
return capabilities;
},