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
+31 -5
View File
@@ -4,13 +4,9 @@
* full text of the license. */
/**
* @requires OpenLayers/Format/XML.js
* @requires OpenLayers/Format/OWSCommon.js
*/
if (!OpenLayers.Format.OWSCommon) {
OpenLayers.Format.OWSCommon = {};
}
/**
* Class: OpenLayers.Format.OWSCommon.v1
* Common readers and writers for OWSCommon v1.X formats
@@ -28,6 +24,23 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
trimComma: (/\s*,\s*/g)
},
/**
* Method: read
*
* Parameters:
* data - {DOMElement} An OWSCommon document element.
* options - {Object} Options for the reader.
*
* Returns:
* {Object} An object representing the OWSCommon document.
*/
read: function(data, options) {
options = OpenLayers.Util.applyDefaults(options, this.options);
var ows = {};
this.readChildNodes(data, ows);
return ows;
},
/**
* Property: readers
* Contains public functions, grouped by namespace prefix, that will
@@ -38,6 +51,19 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
*/
readers: {
"ows": {
"Exception": function(node, exceptionReport) {
var exception = {
code: node.getAttribute('exceptionCode'),
locator: node.getAttribute('locator'),
texts: []
};
exceptionReport.exceptions.push(exception);
this.readChildNodes(node, exception);
},
"ExceptionText": function(node, exception) {
var text = this.getChildValue(node);
exception.texts.push(text);
},
"ServiceIdentification": function(node, obj) {
obj.serviceIdentification = {};
this.readChildNodes(node, obj.serviceIdentification);