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:
@@ -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);
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.OWSCommon.v1_0_0
|
||||
* Parser for OWS Common version 1.0.0 which can be used by other parsers.
|
||||
* It is not intended to be used on its own.
|
||||
* Parser for OWS Common version 1.0.0.
|
||||
*/
|
||||
OpenLayers.Format.OWSCommon.v1_0_0 = OpenLayers.Class(OpenLayers.Format.OWSCommon.v1, {
|
||||
|
||||
@@ -19,7 +18,7 @@ OpenLayers.Format.OWSCommon.v1_0_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
* {Object} Mapping of namespace aliases to namespace URIs.
|
||||
*/
|
||||
namespaces: {
|
||||
ows: "http://www.opengis.net/ows/1.0",
|
||||
ows: "http://www.opengis.net/ows",
|
||||
xlink: "http://www.w3.org/1999/xlink"
|
||||
},
|
||||
|
||||
@@ -32,7 +31,16 @@ OpenLayers.Format.OWSCommon.v1_0_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
* from the parent.
|
||||
*/
|
||||
readers: {
|
||||
"ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"]
|
||||
"ows": OpenLayers.Util.applyDefaults({
|
||||
"ExceptionReport": function(node, obj) {
|
||||
obj.exceptionReport = {
|
||||
version: node.getAttribute('version'),
|
||||
language: node.getAttribute('language'),
|
||||
exceptions: []
|
||||
};
|
||||
this.readChildNodes(node, obj.exceptionReport);
|
||||
}
|
||||
}, OpenLayers.Format.OWSCommon.v1.prototype.readers.ows)
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -42,9 +50,9 @@ OpenLayers.Format.OWSCommon.v1_0_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
* node names they produce.
|
||||
*/
|
||||
writers: {
|
||||
"ows": OpenLayers.Format.OWSCommon.v1.prototype.writers["ows"]
|
||||
"ows": OpenLayers.Format.OWSCommon.v1.prototype.writers.ows
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.OWSCommon.v1_1_0"
|
||||
CLASS_NAME: "OpenLayers.Format.OWSCommon.v1_0_0"
|
||||
|
||||
});
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Format.OWSCommon.v1_1_0
|
||||
* Parser for OWS Common version 1.1.0 which can be used by other parsers.
|
||||
* It is not intended to be used on its own.
|
||||
* Parser for OWS Common version 1.1.0.
|
||||
*/
|
||||
OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.OWSCommon.v1, {
|
||||
|
||||
@@ -33,6 +32,14 @@ OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.OWSCommo
|
||||
*/
|
||||
readers: {
|
||||
"ows": OpenLayers.Util.applyDefaults({
|
||||
"ExceptionReport": function(node, obj) {
|
||||
obj.exceptionReport = {
|
||||
version: node.getAttribute('version'),
|
||||
language: node.getAttribute('xml:lang'),
|
||||
exceptions: []
|
||||
};
|
||||
this.readChildNodes(node, obj.exceptionReport);
|
||||
},
|
||||
"AllowedValues": function(node, parameter) {
|
||||
parameter.allowedValues = {};
|
||||
this.readChildNodes(node, parameter.allowedValues);
|
||||
|
||||
Reference in New Issue
Block a user