[OpenLayers-Users] loading XML problem

Andrew Larcombe andrew at andrewlarcombe.co.uk
Mon Sep 24 17:44:03 EDT 2007


On 24 Sep 2007, at 15:35, Bart van den Eijnden (OSGIS) wrote:

> 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.

The difference looks to be in that in the first case the ActiveX  
control loads the contents of the xml file, whilst in the second it  
is passed the contents of the xml file as held in a variable. If the  
process of reading that file's contents into the variable munge up  
the xml somehow then that might be where your problem is.

Can you attempt to further isolate the problem outside of OL by  
creating an AJAX request to your url, storing it in a variable, then  
loading it into the activex control using loadXML.

Cheers,

Andrew

---
Andrew Larcombe
Freelance Geospatial, Database & Web Programming

web: http://www.andrewlarcombe.co.uk
email: andrew at andrewlarcombe.co.uk
icq: 306690163







More information about the Users mailing list