Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
google maps when using an xml file to display markers

Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
New one
New one

Joined: 25 Aug 2008
Posts: 1

PostPosted: Mon Aug 25, 2008 5:54 pm    Post subject: google maps when using an xml file to display markers Reply with quote

He guys,

I have a problem with google maps.
When I run the code as mentioned hereunder I get a google maps WITHOUT any markers. The XML file however consists of 200 markers which I'd like to show on my map.
I have no idea what went wrong because I don't get any error message.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <script src="http://maps.google.com/maps?file=api&v=2&key=dat is geheim!"
    <script type="text/javascript">


    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(51.800000, 5.500000), 8);

        GDownloadUrl("markers.xml", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var naam = markers[i].getAttribute("Naam");
            var adres = markers[i].getAttribute("Adres");
            var postcode = markers[i].getAttribute("Postcode");
         var woonplaats = markers[i].getAttribute("Woonplaats");
            var email = markers[i].getAttribute("Email");
            var contactpersoon = markers[i].getAttribute("Contactpersoon");
         var telefoon = markers[i].getAttribute("Telefoon");
            var website = markers[i].getAttribute("Website");
            var point = new GLatLng(parseFloat(markers[i].getAttribute("Latitude")),
            var marker = createMarker(point, naam, adres, postcode, woonplaats, email, contactpersoon, telefoon, website);

    function createMarker(point, naam, adres, postcode, woonplaats, email, contactpersoon, telefoon, website) {
      var marker = new GMarker(point);
      var html = "<b>" + naam + "</b> <br/>" + adres + "<br/>" + postcode + " " + woonplaats + "<br/>" + contactpersoon + "<br/>" +       telefoon + "<br/>" + email + "<br/>" + website;
      GEvent.addListener(marker, 'click', function() {
      return marker;

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 1200px; height: 1000px"></div>

and an example of the xml structure

<?xml version="1.0" encoding="iso-8859-1" ?>
  <marker Naam="Aatop" Adres="Nijverheidsstraat 60" Postcode="3371 XE" Woonplaats="Hardinxveld-Giessendam" Email="info@aatop.nl" Contactpersoon="" Telefoon="0184-620820" Website="http://www.aatop.nl" Latitude="51.823475" Longitude="4.809977" />

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 XML & Copyright Notice 

Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X

Link to our site:


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos

Normal Bookmark

Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax

Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?

it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert