make OWSCommon v1 support constraints in Get and Post nodes

This commit is contained in:
Éric Lemoine
2011-11-07 12:29:16 +01:00
committed by ahocevar
parent 98363370b6
commit 4076c1af99
2 changed files with 30 additions and 1 deletions

View File

@@ -173,10 +173,22 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
"Get": function(node, http) {
http.get = this.getAttributeNS(node,
this.namespaces.xlink, "href");
if (!http.constraints) {
http.constraints = {};
}
var obj = {};
this.readChildNodes(node, obj);
http.constraints.get = obj.constraints;
},
"Post": function(node, http) {
http.post = this.getAttributeNS(node,
this.namespaces.xlink, "href");
if (!http.constraints) {
http.constraints = {};
}
var obj = {};
this.readChildNodes(node, obj);
http.constraints.post = obj.constraints;
},
"Parameter": function(node, operation) {
if (!operation.parameters) {
@@ -186,6 +198,14 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
operation.parameters[name] = {};
this.readChildNodes(node, operation.parameters[name]);
},
"Constraint": function(node, obj) {
if (!obj.constraints) {
obj.constraints = {};
}
var name = node.getAttribute("name");
obj.constraints[name] = {};
this.readChildNodes(node, obj.constraints[name]);
},
"Value": function(node, allowedValues) {
allowedValues[this.getChildValue(node)] = true;
},