We found out what was not working for us. I've prepared a patch that solved the problem.

Could anyone confirm that there is a bug in the original version, please ?

 Kind regards,

Alexandre

Alexandre Dube wrote:
Hi users,

 I'm having a hard time using the WMSGetFeatureInfo format.

Instead of explaining, below's snippet (1). Because I currently can't have a response from my server since I have problems with HTTPS and proxy, I load a xml (see attached) instead ( it's a msGMLOutput XML from MapServer ).

 I get an empty features array.  Any clue what I'm doing wrong ?

(1) /*---------snippet---------*/
   showResult: function(response){
       var oFeatures;
       var oFormat = new OpenLayers.Format.WMSGetFeatureInfo();
       if(!response){
           var xmlDoc=document.implementation.createDocument("","",null);
           xmlDoc.async="false";
           xmlDoc.load("response.xml");
           oFeatures = oFormat.read_msGMLOutput(xmlDoc);
       } else {
           oFeatures = oFormat.read_msGMLOutput(response.responseXML ||
                                                response.responseText);
       }

------------------------------------------------------------------------

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users


--
Alexandre Dubé
Mapgears
www.mapgears.com

Index: WMSGetFeatureInfo.js
===================================================================
--- WMSGetFeatureInfo.js	(revision 8947)
+++ WMSGetFeatureInfo.js	(working copy)
@@ -177,27 +177,27 @@
         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<n; k++){
+                child = children[k];
+                while (child && child.nodeType != 1) {
+                    child = child.nextSibling;
+                    k++;
                 }
-            }
-            else {
-                for (var i = 0; i < n; i++) {
+                tagName = (child ? child.nodeName : '');
+                if (tagName.length > 0 && tagName.indexOf(criteria) > -1) {
+                    nodes.push(child);
+                } else {
                     matchNodes = this.getSiblingNodesByTagCriteria(
-                        children[i], criteria);
-                    (nodes.length == 0) ? 
-                        nodes = matchNodes : nodes.push(matchNodes);
+                        child, criteria);
+
+                    if(matchNodes.length > 0){
+                        (nodes.length == 0) ? 
+                            nodes = matchNodes : nodes.push(matchNodes);
+                    }
                 }
             }
+
         }
         return nodes;
     },
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to