[OpenLayers-Users] loading XML problem

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Sep 25 10:10:41 EDT 2007


Ofcourse I can always use proxy.cgi and override the content-type there.

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: Bart van den Eijnden OSGIS <bartvde at osgis.nl>, Andrew Larcombe
<andrew at andrewlarcombe.co.uk>
Cc: users at openlayers.org
Onderwerp: Re: [OpenLayers-Users] loading XML problem
Datum: 25/09/07 06:55

> 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 &lt;bartvde at osgis.nl&gt;
> Naar: Andrew Larcombe &lt;andrew at andrewlarcombe.co.uk&gt;
> Cc: users at openlayers.org
> Onderwerp: Re: [OpenLayers-Users] loading XML problem
> Datum: 25/09/07 05:52
> 
> &gt; It seems responseText cannot deal with ISO-8859-1, so the only way to
do
> &gt; that is to use responseXML.
> &gt; 
> &gt;
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/b035fdea-8665-4d7b-80f0-3624d269e7b6.asp
> &gt; 
> &gt; Best regards,
> &gt; Bart
> &gt; 
> &gt; --
> &gt; Bart van den Eijnden
> &gt; OSGIS, Open Source GIS
> &gt; http://www.osgis.nl
> &gt; 
> &gt; 
> &gt; --------- Oorspronkelijk bericht --------
> &gt; Van: Andrew Larcombe &amp;lt;andrew at andrewlarcombe.co.uk&amp;gt;
> &gt; Naar: 
> &gt; Cc: users at openlayers.org
> &gt; Onderwerp: Re: [OpenLayers-Users] loading XML problem
> &gt; Datum: 24/09/07 19:44
> &gt; 
> &gt; &amp;gt; 
> &gt; &amp;gt; On 24 Sep 2007, at 15:35, Bart van den Eijnden (OSGIS)
wrote:
> &gt; &amp;gt; 
> &gt; &amp;gt; &amp;amp;gt; This works fine (result = true):
> &gt; &amp;gt; &amp;amp;gt;
> &gt; &amp;gt; &amp;amp;gt; var url =
'http://www.osgis.nl/download/weggeg.xml';
> &gt; &amp;gt; &amp;amp;gt; var xmlDoc=new
> ActiveXObject(&amp;amp;quot;Microsoft.XMLDOM&amp;amp;quot;);
> &gt; &amp;gt; &amp;amp;gt; xmlDoc.async=false;
> &gt; &amp;gt; &amp;amp;gt; result = xmlDoc.load(url);
> &gt; &amp;gt; &amp;amp;gt;
> &gt; &amp;gt; &amp;amp;gt; Whereas this does not work (result = false):
> &gt; &amp;gt; &amp;amp;gt;
> &gt; &amp;gt; &amp;amp;gt; var url =
'http://www.osgis.nl/download/weggeg.xml';
> &gt; &amp;gt; &amp;amp;gt; OpenLayers.loadURL(url, null, this,
parseGetCapabilities);
> &gt; &amp;gt; &amp;amp;gt;
> &gt; &amp;gt; &amp;amp;gt; function parseGetCapabilities(ajaxRequest)
> &gt; &amp;gt; &amp;amp;gt; {
> &gt; &amp;gt; &amp;amp;gt;   var text = ajaxRequest.responseText;
> &gt; &amp;gt; &amp;amp;gt;   var xmlDoc=new
> ActiveXObject(&amp;amp;quot;Microsoft.XMLDOM&amp;amp;quot;);
> &gt; &amp;gt; &amp;amp;gt;   xmlDoc.async=false;
> &gt; &amp;gt; &amp;amp;gt;   result = xmlDoc.loadXML(text);
> &gt; &amp;gt; &amp;amp;gt; }
> &gt; &amp;gt; &amp;amp;gt;
> &gt; &amp;gt; &amp;amp;gt; result is false in this case with the parsing
error pointing
> to the  
> &gt; &amp;gt; &amp;amp;gt; special
> &gt; &amp;gt; &amp;amp;gt; character.
> &gt; &amp;gt; 
> &gt; &amp;gt; The difference looks to be in that in the first case the
ActiveX  
> &gt; &amp;gt; control loads the contents of the xml file, whilst in the
second it  
> &gt; &amp;gt; is passed the contents of the xml file as held in a
variable. If the 
> 
> &gt; &amp;gt; process of reading that file's contents into the variable
munge up  
> &gt; &amp;gt; the xml somehow then that might be where your problem is.
> &gt; &amp;gt; 
> &gt; &amp;gt; Can you attempt to further isolate the problem outside of OL
by  
> &gt; &amp;gt; creating an AJAX request to your url, storing it in a
variable, then 
> 
> &gt; &amp;gt; loading it into the activex control using loadXML.
> &gt; &amp;gt; 
> &gt; &amp;gt; Cheers,
> &gt; &amp;gt; 
> &gt; &amp;gt; Andrew
> &gt; &amp;gt; 
> &gt; &amp;gt; ---
> &gt; &amp;gt; Andrew Larcombe
> &gt; &amp;gt; Freelance Geospatial, Database &amp;amp;amp; Web Programming
> &gt; &amp;gt; 
> &gt; &amp;gt; web: http://www.andrewlarcombe.co.uk
> &gt; &amp;gt; email: andrew at andrewlarcombe.co.uk
> &gt; &amp;gt; icq: 306690163
> &gt; &amp;gt; 
> &gt; &amp;gt; 
> &gt; &amp;gt; 
> &gt; &amp;gt; 
> &gt; &amp;gt; _______________________________________________
> &gt; &amp;gt; Users mailing list
> &gt; &amp;gt; Users at openlayers.org
> &gt; &amp;gt; http://openlayers.org/mailman/listinfo/users
> &gt; &amp;gt; 
> &gt; &amp;gt; 
> &gt; 
> &gt; 
> &gt; 
> &gt; _______________________________________________
> &gt; Users mailing list
> &gt; Users at openlayers.org
> &gt; http://openlayers.org/mailman/listinfo/users
> &gt; 
> &gt; 
> 
> 
> 
> 
> 






More information about the Users mailing list