allow WFS protocol to use a different outputFormat, for instance json, patch by rdewit, r=me (closes #2107)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9725 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2009-10-07 18:21:59 +00:00
parent 7919d2a314
commit 5a9e1fe0b4
4 changed files with 63 additions and 35 deletions

View File

@@ -64,6 +64,15 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
* this property can be used to extend the default format options.
*/
formatOptions: null,
/**
* Property: readFormat
* {<OpenLayers.Format>} For WFS requests it is possible to get a
* different output format than GML. In that case, we cannot parse
* the response with the default format (WFST) and we need a different
* format for reading.
*/
readFormat: null,
/**
* Constructor: OpenLayers.Protocol.WFS
@@ -105,7 +114,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
this.setNamespace("feature", this.featureNS);
}
return readNode.apply(this, arguments);
}
};
}
},
@@ -188,7 +197,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
response.code = OpenLayers.Protocol.Response.FAILURE;
}
options.callback.call(options.scope, response);
};
}
},
/**
@@ -210,7 +219,8 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
if(!doc || doc.length <= 0) {
return null;
}
return this.format.read(doc);
return (this.readFormat !== null) ? this.readFormat.read(doc) :
this.format.read(doc);
},
/**