use namespace URI instead of prefix as suggested by @tschaub and discussed with @ahocevar

This commit is contained in:
Bart van den Eijnden
2013-02-13 20:58:48 +01:00
parent f16664cb87
commit 13d95b90a3
8 changed files with 22 additions and 35 deletions
+2 -9
View File
@@ -1,5 +1,4 @@
goog.provide('ol.parser.XML');
goog.require('goog.object');
@@ -7,12 +6,6 @@ goog.require('goog.object');
* @constructor
*/
ol.parser.XML = function() {
// clone the namespaces object and set all namespace aliases
this.namespaces = goog.object.clone(this.namespaces);
this.namespaceAlias = {};
for (var alias in this.namespaces) {
this.namespaceAlias[this.namespaces[alias]] = alias;
}
};
@@ -30,8 +23,8 @@ ol.parser.XML.prototype.readNode = function(node, obj) {
if (!obj) {
obj = {};
}
var group = this.readers[node.namespaceURI ?
this.namespaceAlias[node.namespaceURI] : this.defaultPrefix];
var group = this.readers[node.namespaceURI] ||
this.readers[this.defaultNamespaceURI];
if (group) {
var local = node.localName || node.nodeName.split(':').pop();
var reader = group[local] || group['*'];