From 3be75cc8d9b286137e25dbae5ce940d9e16fd487 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 23 Mar 2009 20:20:47 +0000 Subject: [PATCH] Improvements to the WMSGetFeatureInfo format which was not able to parse some Mapserver responses. Thanks adube for the patch. r=me (closes #2002) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9123 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Format/WMSGetFeatureInfo.js | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/OpenLayers/Format/WMSGetFeatureInfo.js b/lib/OpenLayers/Format/WMSGetFeatureInfo.js index 00521aa295..2362b1524c 100644 --- a/lib/OpenLayers/Format/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Format/WMSGetFeatureInfo.js @@ -177,27 +177,27 @@ OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, { if (node && node.hasChildNodes()) { children = node.childNodes; n = children.length; - child = children[0]; - while (child && child.nodeType != 1) { - child = child.nextSibling; - } - tagName = (child ? child.nodeName : ''); - if (tagName.length > 0 && tagName.indexOf(criteria) > -1) { - for (var i = 0; i < n; i++) { - child = children[i]; - if (child.nodeType == 1) { - nodes.push(child); + + for(var k=0; k 0 && tagName.indexOf(criteria) > -1) { + nodes.push(child); + } else { + matchNodes = this.getSiblingNodesByTagCriteria( + child, criteria); + + if(matchNodes.length > 0){ + (nodes.length == 0) ? + nodes = matchNodes : nodes.push(matchNodes); } } } - else { - for (var i = 0; i < n; i++) { - matchNodes = this.getSiblingNodesByTagCriteria( - children[i], criteria); - (nodes.length == 0) ? - nodes = matchNodes : nodes.push(matchNodes); - } - } + } return nodes; },