[OpenLayers-Dev] Firefox splitting XML nodes with length greater than 4096

Thorsten Müller mueller at terrestris.de
Fri Apr 29 06:26:17 EDT 2011


Dear list,

unfortunately Firefox splits xml nodes with a length greater than 4096 
Bytes into several nodes. Due to that some format readers of OpenLayers 
run into problems.

Let's take a look at WMSGetFeatureInfo-Format reader 
(OpenLayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js) especially at 
this part of parseAttributes-function:

                 if (child.nodeType == 1) {
                     var grandchildren = child.childNodes;
                     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;
                         }
                     }
                 }

Here in Firefox with a node value length greater than 4096 there will be 
more than one grandchildren and the whole attribute will be skipped. 
This behaviour is to be found in several other format reader like 
parseAttributes-function in OpenLayers/lib/OpenLayers/Format/GML.js.

One possible first workaround for that may be adding functionality to 
merge nodeValues of all following grandchildren i.e.:

                     if (grandchildren.length > 1) {
                         var m = grandchildren.length;
                         var combinedText = '';
                         for (var j = 0; j < m; ++j) {
                             var oneGrandchild = grandchildren[j];
                             if (oneGrandchild.nodeType == 3 ||
                             oneGrandchild.nodeType == 4) {
                                 combinedText += 
oneGrandchild.nodeValue.replace(this.regExes.trimSpace, "");
                             }
                         }
                         attributes[name] = combinedText;
                     }


Is this a known problem with format readers in combination with firefox 
and node values with a length greater than 4096? Are there any existing 
plans to solve this problem or even ideas for that?

Any comments appreciated!

Best,

Thorsten

-- 

   Diplom-Informatiker Thorsten Müller
   -Information Technology Consultant-

   terrestris GmbH&  Co. KG
   Irmintrudisstraße 17
   53111 Bonn

   Tel:    ++49 (0)228 / 96 28 99 -52
   Fax:    ++49 (0)228 / 96 28 99 -57

   Email:  mueller at terrestris.de
   Web:    http://www.terrestris.de

   Amtsgericht Bonn, HRA 6835
   Komplementärin:  terrestris Verwaltungs GmbH
   vertreten durch: Hinrich Paulsen, Till Adams


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110429/0f0037a5/attachment.html


More information about the Dev mailing list