[OpenLayers-Users] loading XML problem

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Sep 25 04:55:07 EDT 2007


Hmm, it gets trickier.

I was using the code from Omniverdi's WMSManager.

But since the mimetype of a OGC WMS 1.1.X GetCapabilities response  is
application/vnd.ogc.wms_xml, I cannot use responseXML in IE :-(

This leads me to the following conclusion: when using ISO-8859-1 and having
special characters in an OGC WMS 1.1.X GetCapabilities document you cannot
parse the XML from an AJAX request client-side with IE .... or am I missing
something?

Best regards,
Bart

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


--------- Oorspronkelijk bericht --------
Van: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Naar: Andrew Larcombe <andrew at andrewlarcombe.co.uk>
Cc: users at openlayers.org
Onderwerp: Re: [OpenLayers-Users] loading XML problem
Datum: 25/09/07 05:52

> 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 &lt;andrew at andrewlarcombe.co.uk&gt;
> Naar: 
> Cc: users at openlayers.org
> Onderwerp: Re: [OpenLayers-Users] loading XML problem
> Datum: 24/09/07 19:44
> 
> &gt; 
> &gt; On 24 Sep 2007, at 15:35, Bart van den Eijnden (OSGIS) wrote:
> &gt; 
> &gt; &amp;gt; This works fine (result = true):
> &gt; &amp;gt;
> &gt; &amp;gt; var url = 'http://www.osgis.nl/download/weggeg.xml';
> &gt; &amp;gt; var xmlDoc=new
ActiveXObject(&amp;quot;Microsoft.XMLDOM&amp;quot;);
> &gt; &amp;gt; xmlDoc.async=false;
> &gt; &amp;gt; result = xmlDoc.load(url);
> &gt; &amp;gt;
> &gt; &amp;gt; Whereas this does not work (result = false):
> &gt; &amp;gt;
> &gt; &amp;gt; var url = 'http://www.osgis.nl/download/weggeg.xml';
> &gt; &amp;gt; OpenLayers.loadURL(url, null, this, parseGetCapabilities);
> &gt; &amp;gt;
> &gt; &amp;gt; function parseGetCapabilities(ajaxRequest)
> &gt; &amp;gt; {
> &gt; &amp;gt;   var text = ajaxRequest.responseText;
> &gt; &amp;gt;   var xmlDoc=new
ActiveXObject(&amp;quot;Microsoft.XMLDOM&amp;quot;);
> &gt; &amp;gt;   xmlDoc.async=false;
> &gt; &amp;gt;   result = xmlDoc.loadXML(text);
> &gt; &amp;gt; }
> &gt; &amp;gt;
> &gt; &amp;gt; result is false in this case with the parsing error pointing
to the  
> &gt; &amp;gt; special
> &gt; &amp;gt; character.
> &gt; 
> &gt; The difference looks to be in that in the first case the ActiveX  
> &gt; control loads the contents of the xml file, whilst in the second it  
> &gt; is passed the contents of the xml file as held in a variable. If the 

> &gt; process of reading that file's contents into the variable munge up  
> &gt; the xml somehow then that might be where your problem is.
> &gt; 
> &gt; Can you attempt to further isolate the problem outside of OL by  
> &gt; creating an AJAX request to your url, storing it in a variable, then 

> &gt; loading it into the activex control using loadXML.
> &gt; 
> &gt; Cheers,
> &gt; 
> &gt; Andrew
> &gt; 
> &gt; ---
> &gt; Andrew Larcombe
> &gt; Freelance Geospatial, Database &amp;amp; Web Programming
> &gt; 
> &gt; web: http://www.andrewlarcombe.co.uk
> &gt; email: andrew at andrewlarcombe.co.uk
> &gt; icq: 306690163
> &gt; 
> &gt; 
> &gt; 
> &gt; 
> &gt; _______________________________________________
> &gt; Users mailing list
> &gt; Users at openlayers.org
> &gt; http://openlayers.org/mailman/listinfo/users
> &gt; 
> &gt; 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 






More information about the Users mailing list