[OpenLayers-Users] loading XML problem

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Mon Sep 24 10:35:17 EDT 2007


Hi list,

I've got a problem when I load an XML file using OpenLayers, that when
parsing IE complains about the special characters in there, though the
encoding is set to ISO-8859-1 in the XML header.

This works fine (result = true):

var url = 'http://www.osgis.nl/download/weggeg.xml';
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
result = xmlDoc.load(url);

Whereas this does not work (result = false):

var url = 'http://www.osgis.nl/download/weggeg.xml';
OpenLayers.loadURL(url, null, this, parseGetCapabilities);

function parseGetCapabilities(ajaxRequest)
{
  var text = ajaxRequest.responseText;
  var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async=false;
  result = xmlDoc.loadXML(text);
}

result is false in this case with the parsing error pointing to the special
character.

Is there anything in OL that sets things to UTF-8 or something similar?

Any pointers appreciated!

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl








More information about the Users mailing list