[OpenLayers-Users] loading XML problem

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Sep 25 03:51:37 EDT 2007


It seems responseText cannot deal with ISO-8859-1, so the only way to do
that is to use responseXML.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/b035fdea-8665-4d7b-80f0-3624d269e7b6.asp

Best regards,
Bart

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


--------- Oorspronkelijk bericht --------
Van: Andrew Larcombe <andrew at andrewlarcombe.co.uk>
Naar: 
Cc: users at openlayers.org
Onderwerp: Re: [OpenLayers-Users] loading XML problem
Datum: 24/09/07 19:44

> 
> On 24 Sep 2007, at 15:35, Bart van den Eijnden (OSGIS) wrote:
> 
> &gt; This works fine (result = true):
> &gt;
> &gt; var url = 'http://www.osgis.nl/download/weggeg.xml';
> &gt; var xmlDoc=new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
> &gt; xmlDoc.async=false;
> &gt; result = xmlDoc.load(url);
> &gt;
> &gt; Whereas this does not work (result = false):
> &gt;
> &gt; var url = 'http://www.osgis.nl/download/weggeg.xml';
> &gt; OpenLayers.loadURL(url, null, this, parseGetCapabilities);
> &gt;
> &gt; function parseGetCapabilities(ajaxRequest)
> &gt; {
> &gt;   var text = ajaxRequest.responseText;
> &gt;   var xmlDoc=new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
> &gt;   xmlDoc.async=false;
> &gt;   result = xmlDoc.loadXML(text);
> &gt; }
> &gt;
> &gt; result is false in this case with the parsing error pointing to the  
> &gt; special
> &gt; 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 &amp; Web Programming
> 
> web: http://www.andrewlarcombe.co.uk
> email: andrew at andrewlarcombe.co.uk
> icq: 306690163
> 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 






More information about the Users mailing list