create attributes with null value for empty attribute nodes.

Original patch by milovanderlinden, simplified by tschaub. r=me
(closes #1556)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9179 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-04-03 16:52:26 +00:00
parent 467dff424c
commit e1b1c814de
2 changed files with 9 additions and 2 deletions

View File

@@ -558,6 +558,12 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
this.regExes.trimSpace, "");
attributes[name] = value;
}
} else {
// If child has no childNodes (grandchildren),
// set an attribute with null value.
// e.g. <prefix:fieldname/> becomes
// {fieldname: null}
attributes[child.nodeName.split(":").pop()] = null;
}
}
}