WCS parsing working properly, but needs more tests; moved errorProperty down to parser, where it arguably belongs, and where it has to live to work with WCS. Also removed null error property on versionedOGC.

This commit is contained in:
Christopher Eykamp
2012-12-27 13:29:02 +01:00
parent 8ff05cdeac
commit b6c2c26580
7 changed files with 36 additions and 31 deletions

View File

@@ -45,14 +45,6 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, {
*/
allowFallback: false,
/**
* APIProperty: errorProperty
* {String} Which property of the returned object to check for in order to
* determine whether or not parsing has failed. In the case that the
* errorProperty is undefined on the returned object, the document will be
* run through an OGCExceptionReport parser.
*/
errorProperty: null,
/**
* Property: name
@@ -193,9 +185,13 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, {
}
var root = data.documentElement;
var version = this.getVersion(root);
this.parser = this.getParser(version);
var obj = this.parser.read(data, options);
if (this.errorProperty !== null && obj[this.errorProperty] === undefined) {
this.parser = this.getParser(version); // Select the parser
var obj = this.parser.read(data, options); // Parse the data
var errorProperty = this.parser.errorProperty || null;
if (errorProperty !== null && obj[errorProperty] === undefined) {
// an error must have happened, so parse it and report back
var format = new OpenLayers.Format.OGCExceptionReport();
obj.error = format.read(data);