Reading a XML file with jQuery?
I have a data file ...
<?xml version="1.0" encoding="UTF-8"?>
<loc version="1.0" src="GSAK">
<waypoint>
<name id="GC1D004"><![CDATA[Zone of Influence]]></name>
<coord lat="47.435067" lon="-123.055417"/>
<type>Geocache</type>
<link text="Waypoint Details">http://www.geocaching.com/seek/cache_details.aspx?guid=BIG HEX #</link>
</waypoint>
</loc>
I got a code fragment from a google maps example ....
// http://marcgrabanski.com/article/jquery-makes-parsing-xml-easy
jQuery.get("data.xml", {}, function(data) {
jQuery(data).find("marker").each(function() {
var marker = jQuery(this);
var latlng = new google.maps.LatLng(parseFloat(marker.attr("lat")),
parseFloat(marker.attr("lng")));
var marker = new google.maps.Marker({position: latlng, map: map});
});
});
So far I have not been able to beat into shape, probably because I know nothing about jQuery. I want to extract the ID, the value in the name node. i.e,Zone of Influence, the lat and lon and the link value, i.e.,
the httpL// string. Help would be appreciated.