WCS 1.1.0 parsing correctlyy; error property still not correctly set so parsing reports errors.

This commit is contained in:
Christopher Eykamp
2012-12-24 18:19:42 +01:00
parent d0986de775
commit 8ff05cdeac
4 changed files with 63 additions and 46 deletions
@@ -17,17 +17,6 @@
OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class(
OpenLayers.Format.XML, { OpenLayers.Format.XML, {
/**
* Property: namespaces
* {Object} Mapping of namespace aliases to namespace URIs.
*/
namespaces: {
wcs: "http://www.opengis.net/wcs",
xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance",
ows: "http://www.opengis.net/ows"
},
regExes: { regExes: {
trimSpace: (/^\s*|\s*$/g), trimSpace: (/^\s*|\s*$/g),
splitSpace: (/\s+/) splitSpace: (/\s+/)
@@ -26,6 +26,18 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
* this instance. * this instance.
*/ */
/**
* Property: namespaces
* {Object} Mapping of namespace aliases to namespace URIs.
*/
namespaces: {
wcs: "http://www.opengis.net/wcs",
xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance",
ows: "http://www.opengis.net/ows"
},
/** /**
* Property: readers * Property: readers
* Contains public functions, grouped by namespace prefix, that will * Contains public functions, grouped by namespace prefix, that will
+40 -30
View File
@@ -18,21 +18,19 @@
OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class(
OpenLayers.Format.WCSCapabilities.v1, { OpenLayers.Format.WCSCapabilities.v1, {
/** /**
* Property: regExes * Property: namespaces
* Compiled regular expressions for manipulating strings. * {Object} Mapping of namespace aliases to namespace URIs.
*/ */
regExes: { namespaces: {
trimSpace: (/^\s*|\s*$/g), wcs: "http://www.opengis.net/wcs/1.1",
removeSpace: (/\s*/g), xlink: "http://www.w3.org/1999/xlink",
splitSpace: (/\s+/), xsi: "http://www.w3.org/2001/XMLSchema-instance",
trimComma: (/\s*,\s*/g) ows: "http://www.opengis.net/ows/1.1"
}, },
errorProperty: "Contents", // <== Not sure if this is strictly required by standard... maybe better to set to NULL?
/** /**
* Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0 * Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0
* Create a new parser for WCS capabilities version 1.1.0. * Create a new parser for WCS capabilities version 1.1.0.
@@ -52,44 +50,56 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class(
*/ */
readers: { readers: {
"wcs": OpenLayers.Util.applyDefaults({ "wcs": OpenLayers.Util.applyDefaults({
"Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities "Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
}, },
"Contents": function(node, request) { "Contents": function(node, request) {
request.featureTypeList = { var contents = [];
contents: [] this.readChildNodes(node, contents);
};
this.readChildNodes(node, request.contents); request.contents = contents;
}, },
"CoverageSummary": function(node, request) { "CoverageSummary": function(node, contents) {
request.featureTypeList = { contents.coverageSummary = {};
coverageSummary: [] this.readChildNodes(node, contents.coverageSummary);
};
this.readChildNodes(node, request.coverageSummary);
}, },
"Identifier": function(node, obj) { "Identifier": function(node, coverageSummary) {
obj.identifier = this.getChildValue(node); coverageSummary.identifier = this.getChildValue(node);
}, },
"SupportedCRS": function(node, obj) { "Title": function(node, coverageSummary) {
coverageSummary.title = this.getChildValue(node);
},
"Abstract": function(node, coverageSummary) {
coverageSummary.abstract = this.getChildValue(node);
},
"SupportedCRS": function(node, coverageSummary) {
var crs = this.getChildValue(node); var crs = this.getChildValue(node);
if(crs) { if(crs) {
if(!obj["supportedCRS"]) { if(!coverageSummary["supportedCRS"]) {
obj["supportedCRS"] = []; coverageSummary["supportedCRS"] = [];
} }
obj["supportedCRS"].push(crs); coverageSummary["supportedCRS"].push(crs);
} }
}, },
"DefaultSRS": function(node, obj) { "SupportedFormat": function(node, coverageSummary) {
var defaultSRS = this.getChildValue(node); var format = this.getChildValue(node);
if (defaultSRS) { if(format) {
obj.srs = defaultSRS; if(!coverageSummary["supportedFormat"]) {
coverageSummary["supportedFormat"] = [];
}
coverageSummary["supportedFormat"].push(format);
} }
} },
}, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]),
"ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"] "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"]
}, },
File diff suppressed because one or more lines are too long