WFS and IE 11

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

WFS and IE 11

Gianni Barrotta
Hi,

can you please tell me if there's some issue with OL and IE 11?

I triyed to load the wfs spatia filter example, but the wfs geometries does not appear at all.

http://www.openlayers.org/dev/examples/wfs-spatial-filter.html

Thank's.


_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: WFS and IE 11

Bart van den Eijnden-5
I personally haven’t even opened up IE11 so I have no idea.


Best regards,
Bart
--
Bart van den Eijnden
Front-end Developer | Boundless
@boundlessgeo

On 22 Nov 2013, at 12:54, Gianni Barrotta <[hidden email]> wrote:

Hi,

can you please tell me if there's some issue with OL and IE 11?

I triyed to load the wfs spatia filter example, but the wfs geometries does not appear at all.

http://www.openlayers.org/dev/examples/wfs-spatial-filter.html

Thank's.

_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev


_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: WFS and IE 11

Steffen G
I have the same problem. It has something to do with the HTTP response text.

If you use:
http://www.openlayers.org/dev/examples/wfs-spatial-filter.html 
 
you get with IE11:
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"><wfs:Query typeName="feature:tasmania_roads" xmlns:NS1=""NS1:xmlns:feature="http://www.openplans.org/topp"><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>the_geom</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates cs="," decimal="." ts=" ">135.45,-47.425 157.95,-36.175</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query></wfs:GetFeature>

and the vector is not displayed in the map.

The reponse is different for IE10 (no "xmlns:NS1=""NS1:xmlns") and older versions. It is:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"><wfs:Query typeName="feature:tasmania_roads" xmlns:feature="http://www.openplans.org/topp"><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>the_geom</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">135.45,-47.425 157.95,-36.175</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query></wfs:GetFeature>

and you can see the vector in the map.

I hope it helps.
Reply | Threaded
Open this post in threaded view
|

Re: WFS and IE 11

Stephen Battey
Steffen G wrote
I have the same problem. It has something to do with the HTTP response text.

If you use:
http://www.openlayers.org/dev/examples/wfs-spatial-filter.html
Thanks Steffen G. We have also hit this problem with one of our OpenLayers clients and initially thought it was a bug in our code.
Your link to that OpenLayers example helped us prove otherwise.

Stepping through the OpenLayers source, the XML is built by native code in the XMLSerializer class. So I suspect this is a bug in IE11, not OpenLayers.

We have put in a workaround for this problem.
We override the write method in the OpenLayers.Format.XML class. After the XML has been generated we do a search-replace on the rogue text in the XML namespace.

Here is the code we run after OpenLayers has loaded:

var _class = OpenLayers.Format.XML;

var originalWriteFunction = _class.prototype.write;

var patchedWriteFunction = function()
{
	var child = originalWriteFunction.apply( this, arguments );
	
	// NOTE: Remove the rogue namespaces as one block of text.
	//       The second fragment "NS1:" is too small on its own and could cause valid text (in, say, ogc:Literal elements) to be erroneously removed.
	child = child.replace( new RegExp( 'xmlns:NS1="" NS1:', 'g' ), '' );
	
	return child;
}

_class.prototype.write = patchedWriteFunction;
Reply | Threaded
Open this post in threaded view
|

Re: WFS and IE 11

krooole
Thanks Stephen,

your fix worked for us. However, we came across the error again when sending multiple operations in a single transaction. In this case, IE11 generates xmlns:NS2, xmlns:NS3 and so on.

We've fixed it by using a more general regex:

child = child.replace(new RegExp('xmlns:NS\\d+="" NS\\d+:', 'g'), '');
Reply | Threaded
Open this post in threaded view
|

Re: WFS and IE 11

Stephen Battey
krooole wrote
Thanks Stephen,

your fix worked for us. However, we came across the error again when sending multiple operations in a single transaction. In this case, IE11 generates xmlns:NS2, xmlns:NS3 and so on.

We've fixed it by using a more general regex:

child = child.replace(new RegExp('xmlns:NS\\d+="" NS\\d+:', 'g'), '');
krooole, that's really useful. We hadn't hit this scenario, but we'll use your generic expression just in case.
Thanks for sharing.