rewrite WMS GetCapabilities parser, tests now pass in IE, r=ahocevar (closes #2283)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9883 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -33,14 +33,23 @@ OpenLayers.Format.WMSCapabilities.v1_1_0 = OpenLayers.Class(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: read_cap_SRS
|
* Property: readers
|
||||||
|
* Contains public functions, grouped by namespace prefix, that will
|
||||||
|
* be applied when a namespaced node is found matching the function
|
||||||
|
* name. The function will be applied in the scope of this parser
|
||||||
|
* with two arguments: the node being read and a context object passed
|
||||||
|
* from the parent.
|
||||||
*/
|
*/
|
||||||
read_cap_SRS: function(layer, node) {
|
readers: {
|
||||||
var srs = this.getChildValue(node);
|
"wms": OpenLayers.Util.applyDefaults({
|
||||||
var values = srs.split(/ +/);
|
"SRS": function(node, obj) {
|
||||||
for (var i=0, len=values.length; i<len; i++) {
|
var srs = this.getChildValue(node);
|
||||||
layer.srs[values[i]] = true;
|
var values = srs.split(/ +/);
|
||||||
}
|
for (var i=0, len=values.length; i<len; i++) {
|
||||||
|
obj.srs[values[i]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers["wms"])
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1_0"
|
CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1_0"
|
||||||
|
|||||||
@@ -33,19 +33,28 @@ OpenLayers.Format.WMSCapabilities.v1_1_1 = OpenLayers.Class(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: read_cap_SRS
|
* Property: readers
|
||||||
|
* Contains public functions, grouped by namespace prefix, that will
|
||||||
|
* be applied when a namespaced node is found matching the function
|
||||||
|
* name. The function will be applied in the scope of this parser
|
||||||
|
* with two arguments: the node being read and a context object passed
|
||||||
|
* from the parent.
|
||||||
*/
|
*/
|
||||||
read_cap_SRS: function(layer, node) {
|
readers: {
|
||||||
var srs = this.getChildValue(node);
|
"wms": OpenLayers.Util.applyDefaults({
|
||||||
if (srs.indexOf(" ")) {
|
"SRS": function(node, obj) {
|
||||||
// v1.1.0 style SRS
|
var srs = this.getChildValue(node);
|
||||||
var values = srs.split(/ +/);
|
if (srs.indexOf(" ")) {
|
||||||
for (var i=0, len=values.length; i<len; i++) {
|
// v1.1.0 style SRS
|
||||||
layer.srs[values[i]] = true;
|
var values = srs.split(/ +/);
|
||||||
|
for (var i=0, len=values.length; i<len; i++) {
|
||||||
|
obj.srs[values[i]] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj.srs[srs] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}, OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers["wms"])
|
||||||
layer.srs[srs] = true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1_1"
|
CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1_1"
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
if(!obj) {
|
if(!obj) {
|
||||||
obj = {};
|
obj = {};
|
||||||
}
|
}
|
||||||
var group = this.readers[this.namespaceAlias[node.namespaceURI]];
|
var group = this.readers[node.namespaceURI ? this.namespaceAlias[node.namespaceURI]: this.defaultPrefix];
|
||||||
if(group) {
|
if(group) {
|
||||||
var local = node.localName || node.nodeName.split(":").pop();
|
var local = node.localName || node.nodeName.split(":").pop();
|
||||||
var reader = group[local] || group["*"];
|
var reader = group[local] || group["*"];
|
||||||
|
|||||||
Reference in New Issue
Block a user