On Sep 1, 9:50 am, hassy33 <[email protected]> wrote:
> Hi all,
>
> I am having an issue with loading my markers from an XML file.
>
> I have a custommap which displays properly. It is the map of a
> floorplan.
> I want to now add people's offices on the map and I am loading their
> coordinates from an XML file.
>
> I took the code from Mike William's tutorial code at the following
> page:http://econym.org.uk/gmap/basic3.htm
>
> This is my XML reading function which adds marker links to the
> sidebar:
> GDownloadUrl("Tel.xml", function(doc) {
>         var xmlDoc = GXml.parse(doc);
>         var markers = xmlDoc.documentElement.getElementsByTagName
> ("item");
>
>         for (var i = 0; i < markers.length; i++) {
>           // obtain the attribues of each marker
>           //var lat = parseFloat(markers[i].getAttribute("lat"));
>           var lat = parseFloat(GXml.value(markers[i].getElementsByTagName
> ("lat")[0]));
>           //var lng = parseFloat(markers[i].getAttribute("lng"));
>           var lng = parseFloat(GXml.value(markers[i].getElementsByTagName
> ("lng")[0]));
>
>           var point = new GLatLng(lat,lng);
>           //var html = markers[i].getAttribute("html");
>           var html = GXml.value(markers[i].getElementsByTagName("Nom")[0]);
>           //var label = markers[i].getAttribute("label");
>           var label = GXml.value(markers[i].getElementsByTagName("LoginName")
> [0]);
>           // create the marker
>           var marker = createMarker(point,label,html,i);
>           map.addOverlay(marker);
>         }
>         // put the assembled side_bar_html contents into the side_bar
> div
>         side_bar_html += '<\/td><\/tr><\/table>';
>         document.getElementById("side_bar").innerHTML = side_bar_html;
>       });
>
> I keep getting a javascript error that says:
> "Error: 'documentElement' is null or not an object"
>
> I tried so many different things and nothing worked. I have a doubt
> that there is something wrong with my XML file because when the
> documentElement object is null, it means that the javascript is not
> parsing the XML file properly.
>
> My XML file can be found at the 
> following:http://www.linkkings.com/hkbica_test/Tel.xml
> My map html page can be found:http://www.linkkings.com/hkbica_test/
>
> I would really appreciate if someone can help me out with this.

Looks to me like you have a problem with the character encoding of
your xml file.
When I use GLog.write to look at the httpXml responseText I see things
like:
<Pr?m>Claudia</Pr?m>

I would suggest not putting accented characters into the tagnames.

  -- 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