Format.WMSGetFeatureInfo: also parse empty elements, p=me,r=erilem (closes #2867)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11688 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2011-03-10 16:36:30 +00:00
parent 9af89ff189
commit 046f0a39ed
2 changed files with 28 additions and 4 deletions

View File

@@ -230,12 +230,14 @@ OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, {
var child = children[i];
if (child.nodeType == 1) {
var grandchildren = child.childNodes;
if (grandchildren.length == 1) {
var name = (child.prefix) ?
child.nodeName.split(":")[1] : child.nodeName;
if (grandchildren.length == 0) {
attributes[name] = null
} else if (grandchildren.length == 1) {
var grandchild = grandchildren[0];
if (grandchild.nodeType == 3 ||
grandchild.nodeType == 4) {
var name = (child.prefix) ?
child.nodeName.split(":")[1] : child.nodeName;
var value = grandchild.nodeValue.replace(
this.regExes.trimSpace, "");
attributes[name] = value;