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:
@@ -22,14 +22,6 @@ OpenLayers.Format.WCSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi
|
||||
*/
|
||||
defaultVersion: "1.1.0",
|
||||
|
||||
/**
|
||||
* 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: "service",
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WCSCapabilities
|
||||
|
||||
@@ -38,6 +38,16 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
|
||||
ows: "http://www.opengis.net/ows"
|
||||
},
|
||||
|
||||
/**
|
||||
* 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: "service",
|
||||
|
||||
|
||||
/**
|
||||
* Property: readers
|
||||
* Contains public functions, grouped by namespace prefix, that will
|
||||
|
||||
@@ -30,6 +30,15 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class(
|
||||
ows: "http://www.opengis.net/ows/1.1"
|
||||
},
|
||||
|
||||
/**
|
||||
* 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: "operationsMetadata",
|
||||
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0
|
||||
|
||||
@@ -21,15 +21,6 @@ OpenLayers.Format.WFSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi
|
||||
* {String} Version number to assume if none found. Default is "1.1.0".
|
||||
*/
|
||||
defaultVersion: "1.1.0",
|
||||
|
||||
/**
|
||||
* 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: "featureTypeList",
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WFSCapabilities
|
||||
|
||||
@@ -28,6 +28,16 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class(
|
||||
ows: "http://www.opengis.net/ows"
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 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: "featureTypeList",
|
||||
|
||||
/**
|
||||
* Property: defaultPrefix
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
var res = parser.read(text);
|
||||
|
||||
debugger;
|
||||
|
||||
t.ok(!res.error, "Parsing XML generated no errors");
|
||||
t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed");
|
||||
@@ -64,8 +63,6 @@
|
||||
|
||||
|
||||
res = parser.read(text);
|
||||
debugger;
|
||||
|
||||
|
||||
t.ok(!res.error, "Parsing XML generated no errors");
|
||||
// ft = res.featureTypeList.featureTypes;
|
||||
|
||||
Reference in New Issue
Block a user