Hi,
I currently have an XML file which displays the addresses in the file
in the form of an icon. The following is the code that I am using:
<script type="text/javascript">
var map;
var geocoder;
var xml;
var markers;
var address;
function initialize() {
if (GBrowserIsCompatible()) {
var map = new
GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(51.066573,-0.313765), 09);
map.setUIToDefault();
// Create new geocoding object
geocoder = new GClientGeocoder();
// Download the data in data.xml and load it on the
map.
GDownloadUrl("./data.xml", function(data) {
xml = GXml.parse(data);
markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
address = markers[i].getAttribute("address");
geocoder.getLocations(address, addToMap);
}
});
}
// This function adds the point to the map
function addToMap(response) {
// Retrieve the object
place = response.Placemark[0];
// Retrieve the latitude and longitude
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
// Create a marker
marker = new GMarker(point);
// Add the marker to map
map.addOverlay(marker);
}
}
</script>
<br />
The XML file is formatted in the following way:
<markers>
<marker address="Address here"/>
<marker address="Address here"/>
</markers>
But now I have an XML which is an output of the records in the
database and what I want to do is use the addresses in that file. But
how do I do it? any ideas?
The other XML file from which I want the addresses to be picked are in
the following format:
<NewDataSet>
<tbl_Member>
<Member_Address>Withdean</Member_Address>
</tbl_Member>
What I have noticed is that the values in the XML file are not within
any quotation marks. Is there anyway I can use the above xml format to
feed into google map to show icons. Or is there a way I could get the
database to output the data in the format mentioned previously?
--
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.