diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index d2b6cfd912..833dbbb873 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -304,6 +304,15 @@ class GMLBase extends XMLFeature { } } + const len = n.attributes.length; + if (len > 0) { + value = {_content_: value}; + for (let i = 0; i < len; i++) { + const attName = n.attributes[i].name; + value[attName] = n.attributes[i].value; + } + } + if (values[localName]) { if (!(values[localName] instanceof Array)) { values[localName] = [values[localName]]; @@ -312,15 +321,6 @@ class GMLBase extends XMLFeature { } else { values[localName] = value; } - - const len = n.attributes.length; - if (len > 0) { - values[localName] = {_content_: values[localName]}; - for (let i = 0; i < len; i++) { - const attName = n.attributes[i].name; - values[localName][attName] = n.attributes[i].value; - } - } } if (!asFeature) { return values;