add support for WFS hit count (1.1) in WFST Format, r=ahocevar (closes #2131)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10268 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-05-03 18:39:42 +00:00
parent a5093a27fa
commit 4658d32b31
3 changed files with 56 additions and 4 deletions

View File

@@ -105,13 +105,31 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
},
/**
* Method: read
* APIMethod: read
* Parse the response from a transaction. Because WFS is split into
* Transaction requests (create, update, and delete) and GetFeature
* requests (read), this method handles parsing of both types of
* responses.
*
* Parameters:
* data - {String | Document} The WFST document to read
* options - {Object} Options for the reader
*
* Valid options properties:
* output - {String} either "features" or "object". The default is
* "features", which means that the method will return an array of
* features. If set to "object", an object with a "features" property
* and other properties read by the parser will be returned.
*
* Returns:
* {Array | Object} Output depending on the output option.
*/
read: function(data) {
read: function(data, options) {
options = options || {};
OpenLayers.Util.applyDefaults(options, {
output: "features"
});
if(typeof data == "string") {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
}
@@ -122,7 +140,7 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
if(data) {
this.readNode(data, obj);
}
if(obj.features) {
if(obj.features && options.output === "features") {
obj = obj.features;
}
return obj;