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

Andreas Hocevar ahocevar at opengeo.org
Tue May 3 04:04:12 EDT 2011


Hey Thorsten,

the issue with the WMSGetFeatureInfo format needs to be addressed -
this is one of the formats that don't use our new sequential parser
based on OpenLayers.Format.XML yet. Also note that the parser built
into OpenLayers.Format.WMSGetFeatureInfo will only be used for some
WMS services (e.g. Mapserver). For others, like GeoServer, there is a
fallback to the plain GML parser.

Which brings us to your next concern, OpenLayers.Format.GML. This is
deprecated, and your build should not include OpenLayers.Format.GML,
but OpenLayers.Format.GML.{v2|v3}. In this case, there won't be a
problem with node content exceeding 4096 bytes - this has been fixed
since http://trac.osgeo.org/openlayers/changeset/4410.

To summarize: If you use GeoServer and don't include
OpenLayers.Format.GML in your build, you won't run into any issues. If
you use GetFeatureInfo with other WMS servers, there will be an issue
with the WMSGetFeatureInfo format, and patches for the parser built
into OpenLayers.Format.WMSGetFeatureInfo to switch it to our new
parser pattern would be welcome.

Andreas.

On Fri, Apr 29, 2011 at 12:26 PM, Thorsten Müller <mueller at terrestris.de> wrote:
> 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
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Dev mailing list