I have a url that returns XML coordinates in the below format. I want to put a Google map on my page and feed it these push pin coordinates. Is there a nice and quick way to do this via Javascript or jQuery?
<messageList>
<totalCount>1</totalCount>
−
<message>
<esn>0-7396996</esn>
<esnName>JOHN</esnName>
<messageType>TEST</messageType>
<messageDetail> ALL IS WELL AT CURRENT LOCATION.</messageDetail>
<timestamp>2010-05-24T00:39:12.000Z</timestamp>
<t开发者_Python百科imeInGMTSecond>1274661552</timeInGMTSecond>
<latitude>25.19483</latitude>
<longitude>65.7162</longitude>
</message>
</messageList>
I would suggest transforming your xml into KML which google maps can handle very happily using an inbuild method called GGeoXml.
KML is a standard geo-coding data format which is used be a number of different mapping solutions.
or you can parse your xml and create a marker like this:
var point= new GLatLng(25.19483, 65.7162);
var marker = new GMarker(point);
map.addOverlay(marker);
精彩评论