Merge pull request #12936 from ejn/bugfix/gml-multiple-element-parsing

Bugfix for GML parsing with multiple property elements with XML attributes
This commit is contained in:
Andreas Hocevar
2022-04-05 11:57:53 +02:00
committed by GitHub
3 changed files with 107 additions and 9 deletions

View File

@@ -319,6 +319,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]];
@@ -327,15 +336,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;