Refactor the use of ol.xml.getLocalName(n)

This commit is contained in:
Florent gravin
2014-10-28 16:48:16 +01:00
parent 51da7bad8c
commit 74410487aa
+5 -4
View File
@@ -159,6 +159,7 @@ ol.format.GMLBase.prototype.readFeature_ = function(node, objectStack) {
var values = {}, geometryName; var values = {}, geometryName;
for (n = node.firstElementChild; !goog.isNull(n); for (n = node.firstElementChild; !goog.isNull(n);
n = n.nextElementSibling) { n = n.nextElementSibling) {
var localName = ol.xml.getLocalName(n);
// Assume attribute elements have one child node and that the child // Assume attribute elements have one child node and that the child
// is a text node. Otherwise assume it is a geometry node. // is a text node. Otherwise assume it is a geometry node.
if (n.childNodes.length === 0 || if (n.childNodes.length === 0 ||
@@ -168,13 +169,13 @@ ol.format.GMLBase.prototype.readFeature_ = function(node, objectStack) {
if (goog.string.isEmpty(value)) { if (goog.string.isEmpty(value)) {
value = undefined; value = undefined;
} }
values[ol.xml.getLocalName(n)] = value; values[localName] = value;
} else { } else {
// boundedBy is an extent and must not be considered as a geometry // boundedBy is an extent and must not be considered as a geometry
if (n.localName !== 'boundedBy') { if (localName !== 'boundedBy') {
geometryName = ol.xml.getLocalName(n); geometryName = localName;
} }
values[ol.xml.getLocalName(n)] = this.readGeometryElement(n, objectStack); values[localName] = this.readGeometryElement(n, objectStack);
} }
} }
var feature = new ol.Feature(values); var feature = new ol.Feature(values);