hi,
i hope the following code will help you.</:INCLUDETAIL>
</:INCLUDETAIL>
/////////////////////////////////////////////////////////////////////////</:INCLUDETAIL>
var nodeArray;</:INCLUDETAIL>
function createXMLHttpRequest()
{
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
}
function loadLineByXml(xmlFileName,tagName)
{
createXMLHttpRequest();
// add something which defined in your *.xml</:INCLUDETAIL>
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
var xmlDoc = GXml.parse(xmlHttp.responseText);
// =========sava the result to Array ===========
nodeArray = xmlDoc.documentElement.getElementsByTagName(tagName);
// 处理每一个节点
for (var i = 0; i < nodeArray.length; i++)
{
addMarkerByXmlNode(nodeArray [i]);
}
}
}
xmlHttp.open("GET", xmlFileName);
xmlHttp.send(null);
}
function addMarkerByXmlNode(node)
{
for (var i = 0; i < markers.length; i++)
{
var name = nodegetAttribute("name");
var address = nodegetAttribute("address");
var phone= nodegetAttribute("phone");
var openingHours = nodegetAttribute("openingHours");
var email = nodegetAttribute("email");
var point = new
GLatLng(parseFloat(nodegetAttribute("lat")),parseFloat(nodegetAttribute("lng")));
// call your function createMarker
var marker = createMarker(point, label, address,phone,
openingHours, email);
map.addOverlay(marker);
}
</:INCLUDETAIL>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---