I would like to know if you can generate two XML files in the same document.
This is the code I have so far:
downloadUrl("connect_xml.php", function (data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var rua = markers[i].getAttribute("rua");
var bairro = markers[i].getAttribute("bairro");
var CEP = markers[i].getAttribute("CEP");
var cidade = markers[i].getAttribute("cidade");
var numero = markers[i].getAttribute("numero");
var image = markers[i].getAttribute("image");
var descricao = markers[i].getAttribute("descricao");
var point = new google.maps.LatLng(
(markers[i].getAttribute("lat")),
(markers[i].getAttribute("lng")));
//var lat = new google.maps.LatLng
//(markers[i].getAttribute("lat"));
// var lng = new google.maps.LatLng
// (markers[i].getAttribute("lng"));
var html = "<b>" + rua + "</b> <br/>" + bairro + "</br>" + CEP + "</br>" + cidade + "</br>" + numero + "</br>" + "</br>" + point + "<img width='80' src=" + image + ">" + "</br> <b>" + descricao + "</b>";
var icon = customIcons[descricao] || {};
var marker = createMarker(point, rua, bairro, CEP, cidade, numero, image, descricao, map);
bindInfoWindow(marker, map, infoWindow, html);
}
});
function searchLocationsNear(center) {
clearLocations();
var searchUrl = 'get_marker.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius;
downloadUrl(searchUrl, function(data) {
var xml = parseXml(data);
var markerNodes = xml.documentElement.getElementsByTagName("marker1");
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markerNodes.length; i++) {
var rua = markerNodes[i].getAttribute("rua");
var bairro = markerNodes[i].getAttribute("bairro");
var distance = parseFloat(markerNodes[i].getAttribute("distance"));
var latlng = new google.maps.LatLng(
parseFloat(markerNodes[i].getAttribute("lat")),
parseFloat(markerNodes[i].getAttribute("lng")));
createOption(rua, distance, i);
createMarker(latlng, rua, bairro);
bounds.extend(latlng);
}
map.fitBounds(bounds);
locationSelect.style.visibility = "visible";
locationSelect.onchange = function() {
var markerNum = locationSelect.options[locationSelect.selectedIndex].value;
google.maps.event.trigger(markers[markerNum], 'click');
};
});
}