Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Loading XML from another website? #27

Open
GoogleCodeExporter opened this issue Aug 3, 2015 · 0 comments
Open

Loading XML from another website? #27

GoogleCodeExporter opened this issue Aug 3, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Hello All,
I need to load an XML file from a website.

I'm using
GDownloadUrl("sonHafta.xml", function(data) code and it works correctly.
but whem i'm trying to use

GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml"

nothing happens.
I'm very new at Google Maps developing

All Of Codes,

    <script type="text/javascript">

    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));

        map.addMapType(G_PHYSICAL_MAP);
        map.addMapType(G_SATELLITE_3D_MAP);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(39.614495, 30.341861), 5);
        map.enableGoogleBar();


        GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("earhquake");
          for (var i = 0; i < markers.length; i++) {
            var latlng = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            map.addOverlay(new GMarker(latlng));
          }
        });
      }
    }



  </script>
Am I need some extra codes to load XML from another website?
I'm working at localhost right now.

Best Regards

Original issue reported on code.google.com by [email protected] on 23 Nov 2011 at 10:36

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant