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
This commit is contained in:
ahocevar
2009-03-23 20:20:47 +00:00
parent 3e55ef6aa3
commit 3be75cc8d9
+18 -18
View File
@@ -177,27 +177,27 @@ OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, {
if (node && node.hasChildNodes()) { if (node && node.hasChildNodes()) {
children = node.childNodes; children = node.childNodes;
n = children.length; n = children.length;
child = children[0];
while (child && child.nodeType != 1) { for(var k=0; k<n; k++){
child = child.nextSibling; child = children[k];
} while (child && child.nodeType != 1) {
tagName = (child ? child.nodeName : ''); child = child.nextSibling;
if (tagName.length > 0 && tagName.indexOf(criteria) > -1) { k++;
for (var i = 0; i < n; i++) { }
child = children[i]; tagName = (child ? child.nodeName : '');
if (child.nodeType == 1) { if (tagName.length > 0 && tagName.indexOf(criteria) > -1) {
nodes.push(child); 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; return nodes;
}, },