rewrite WFSCapabilities parser to the new readers structure, and use OWSCommon readers. This will mean that the return structure will differ for WFS 1.0 and WFS 1.1, but I think it's better to adhere to OWSCommon structures here since this will allow similar structures over different OGC Web Services
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
/**
|
||||
* @requires OpenLayers/Format/WFSCapabilities/v1.js
|
||||
* @requires OpenLayers/Format/OWSCommon/v1.js
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -16,6 +17,17 @@
|
||||
*/
|
||||
OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class(
|
||||
OpenLayers.Format.WFSCapabilities.v1, {
|
||||
|
||||
/**
|
||||
* Property: regExes
|
||||
* Compiled regular expressions for manipulating strings.
|
||||
*/
|
||||
regExes: {
|
||||
trimSpace: (/^\s*|\s*$/g),
|
||||
removeSpace: (/\s*/g),
|
||||
splitSpace: (/\s+/),
|
||||
trimComma: (/\s*,\s*/g)
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WFSCapabilities.v1_1_0
|
||||
@@ -27,63 +39,23 @@ OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class(
|
||||
*/
|
||||
|
||||
/**
|
||||
* Method: read_cap_DefaultSRS
|
||||
* 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_DefaultSRS: function(obj, node) {
|
||||
var defaultSRS = this.getChildValue(node);
|
||||
if (defaultSRS) {
|
||||
obj.srs = defaultSRS;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_OperationsMetadata
|
||||
*/
|
||||
read_cap_ows_OperationsMetadata: function(capabilities, node) {
|
||||
var capability = {
|
||||
request: {}
|
||||
};
|
||||
this.runChildNodes(capability.request, node);
|
||||
capabilities.capability = capability;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Operation
|
||||
*/
|
||||
read_cap_ows_Operation: function(request, node) {
|
||||
var operation = {
|
||||
href: {}
|
||||
};
|
||||
this.runChildNodes(operation.href, node);
|
||||
request[node.getAttribute("name").toLowerCase()] = operation;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_DCP
|
||||
*/
|
||||
read_cap_ows_DCP: function(href, node) {
|
||||
this.runChildNodes(href, node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_HTTP
|
||||
*/
|
||||
read_cap_ows_HTTP: function(href, node) {
|
||||
this.runChildNodes(href, node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Get
|
||||
*/
|
||||
read_cap_ows_Get: function(href, node) {
|
||||
href["get"] = node.getAttribute("xlink:href");
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Post
|
||||
*/
|
||||
read_cap_ows_Post: function(href, node) {
|
||||
href["post"] = node.getAttribute("xlink:href");
|
||||
readers: {
|
||||
"wfs": OpenLayers.Util.applyDefaults({
|
||||
"DefaultSRS": function(node, obj) {
|
||||
var defaultSRS = this.getChildValue(node);
|
||||
if (defaultSRS) {
|
||||
obj.srs = defaultSRS;
|
||||
}
|
||||
}
|
||||
}, OpenLayers.Format.WFSCapabilities.v1.prototype.readers["wfs"]),
|
||||
"ows": OpenLayers.Format.OWSCommon.v1.prototype.readers.ows
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0"
|
||||
|
||||
Reference in New Issue
Block a user