On Aug 2, 2010, at 11:07 AM, ext Sven Geggus wrote:

> Arnd Wippermann <arnd.wipperm...@web.de> wrote:
> 
>>   brewpub_layer.events.register("loadend", brewpub_layer, function (e) {
>>       var fts = this.features;
>>       for(var i=0;i<fts.length;i++)
>>       {
>>           theHTML = fts[i].attributes.name + ", " + 
>> fts[i].attributes.description + "<br>";
>>       }
>>   }); 
> 
> Ok, while this works for feature attributes it does still not give me the
> the "global" name and description attributes of my kml document as a whole
> as well as those attributes inside the folder definition but those are
> actually the ones I am interested in.
> 
> My kml looks like this (roughly):
> <?xml version="1.0" encoding="UTF-8"?>
> <kml xmlns="http://www.opengis.net/kml/2.2"; ...
> <Document>
>        <name>Name of KML Document</name>
>        <Folder>
>                <name>Folder Name</name>
>                 <description>Folder description</name>
> 
>                 ... features come here
> 
>        </Folder>
> </Document>
> </kml>
> 
> So the question is how to access these attributes from javascript.

OpenLayers doesn't parse this data. You can get access to the raw KML
by setting the keepData option:

  
http://dev.openlayers.org/apidocs/files/OpenLayers/Format-js.html#OpenLayers.Format.keepData

Then reading the XML doc from format.data, and doing your own parsing.

-- Chris

> Regards
> 
> Sven
> 
> -- 
> The main thing to note is that when you choose open source you don't
> get a Windows operating system.
>                                  (from http://www.dell.com/ubuntu)
> /me is gig...@ircnet, http://sven.gegg.us/ on the Web
> _______________________________________________
> 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