On Oct 6, 3:24 am, debaser <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a KML file which defines a description used for the infoWindow.
> The description tag contains CDATA which defines a div to be used to
> display in the infoWindow, e.g.:
>
> <Placemark>
>   ...
>   <description><![CDATA[
>   <div style="font-size:9pt;font-family:trebuchet
> MS,verdana,sans;margin-top:2px;margin-left:2px;line-height:9pt;">
>   <p>this is only a test</p>
>   <p>of the emergency broadcast system</p>
>   </div>
>   ]]></description>
> </Placemark>
>
> My problem comes in now, that instead of using the built in GGeoXml
> utility to show markers, I'm manually reading the data using
> GDownloadUrl:
>
> GDownloadUrl(mapDataKmlUrl, function(data, responseCode) {
>       var kml = GXml.parse(data);
>       doStuff(kml);
>     });
>
> ... where doStuff shows markers depending on the content defined in
> the Placemarks. What I want to do now, is add an event to the marker
> to display the same info window as would be shown before using the
> GGeoXml utility, which would use the description's CDATA to add a div
> to the infoWindow:
>
> GEvent.addListener(marker, "click", function() {
>     var infoWindowContent =
> retrieveDescriptionFromPlacemark(placemark);
>     marker.openInfoWindowHtml(infoWindowContent);
>   });
>
> I tried the following:
>
> function retrieveDescriptionFromPlacemark(placemark) {
>   return placemark.getElementsByTagName("description")
> [0].childNodes[0].nodeValue;
>
> }
>
> ... but it returns a blank string for that node. Any suggestions on
> how to get the actual div content would be greatly appreciated.
>

1. Please post a link to your map that shows the problem:
http://groups.google.com/group/Google-Maps-API/web/suggested-posting-guidelines

2. I have no idea what is wrong with your code as you didn't post a
link, but something like:
**** TOTALLY UNTESTED ***
var infoWindowContents =
GXml.parse(kml.getElementsByTagName("Placemark")
[i].getElementsByTagName("description")[0]);
should work.

  -- Larry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to