Hi,

you don't need Format.XML in between but I doubt that's your problem.

var CAPformat = new OpenLayers.Format.WMSCapabilities();
var cap = CAPformat.read(response.responseXML || response.responseText);

Can you share the output of your WMS GetCapabilities response?

Best regards,
Bart

>
> Hi.
>
> I'm trying to parse WMS GetCapabilities response to get LegendURLs.
> I started with sample from http://trac.openlayers.org/ticket/1176 and was
> able to read "version" property.
> However I can't read "Service" and "Capability" nodes of response. They
> show
> up as undefined in firebug console.
> I tried Openlayers 2.8 and latest nightly build.
> Here is my piece of code:
>
> var request = OpenLayers.Request.GET({
>       url:
> "http://apps1.gdr.nrcan.gc.ca/cgi-bin/worldmin_en-ca_ows?request=GetCapabilities&service=WMS&version=1.1.1";,
>       success: function(response) {
>               var XMLformat = new OpenLayers.Format.XML();
>               var xml = XMLformat.read(response.responseText);
>               var CAPformat = new OpenLayers.Format.WMSCapabilities();
>               var cap = CAPformat.read(xml);
>               window.console.log("Capabilities: " + cap);
>               window.console.log("Capabilities.version: " + cap.version);
>               window.console.log("Capabilities.service: " + cap.service);
>               window.console.log("Capabilities.capability: " + 
> cap.capability);
>       }
> });
>
> What's wrong with my code?
> --
> View this message in context:
> http://n2.nabble.com/WMSCapabilities-parse-problem-tp4660147p4660147.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users@openlayers.org
> http://openlayers.org/mailman/listinfo/users
>


_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to