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
+10 -10
View File
@@ -177,28 +177,28 @@ 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];
for(var k=0; k<n; k++){
child = children[k];
while (child && child.nodeType != 1) { while (child && child.nodeType != 1) {
child = child.nextSibling; child = child.nextSibling;
k++;
} }
tagName = (child ? child.nodeName : ''); tagName = (child ? child.nodeName : '');
if (tagName.length > 0 && tagName.indexOf(criteria) > -1) { 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); nodes.push(child);
} } else {
}
}
else {
for (var i = 0; i < n; i++) {
matchNodes = this.getSiblingNodesByTagCriteria( matchNodes = this.getSiblingNodesByTagCriteria(
children[i], criteria); child, criteria);
if(matchNodes.length > 0){
(nodes.length == 0) ? (nodes.length == 0) ?
nodes = matchNodes : nodes.push(matchNodes); nodes = matchNodes : nodes.push(matchNodes);
} }
} }
} }
}
return nodes; return nodes;
}, },