Okay, I'm having trouble making my application fly in Mozilla, using Firefox 2.0.0.11 as a test platform. Using web searches for "JavaScript XML" and the like I've found many good examples for loading and parsing XML in JavaScript... I'm already familiar with loading and parsing XML in ActionScript and classic ASP, so the basics haven't been that difficult.
I've got the whole thing working just fine if I use a static XML page. If I call an ASP page to build a dynamic XML, however, only the MSIE portion of the code functions. The code is not changing, so it's something to do with the difference between static and dynamically constructed XML.
With the understanding that it's dirty because I'm still trying to hack it all together, here's the XML code for your review:
I've got the whole thing working just fine if I use a static XML page. If I call an ASP page to build a dynamic XML, however, only the MSIE portion of the code functions. The code is not changing, so it's something to do with the difference between static and dynamically constructed XML.
With the understanding that it's dirty because I'm still trying to hack it all together, here's the XML code for your review:
Code:
var xmlPath = "GUI_GET_AssetLocations.asp"
//(loadXML function called on page load)
function loadXML()
{
// Check for Mozilla browser type
if (document.implementation && document.implementation.createDocument)
{
// Build XMLDOM object and establish "onload" event for Mozilla
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.ignorewhitespace = true;
xmlDoc.onload = display;
}
// Check for Internet Explorer browser type
else
{
// Build XMLDOM object and establish "onload" event for MSIE
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function ()
{
if (xmlDoc.readyState == 4) display()
};
}
// Load XML based on passed path
xmlDoc.load(xmlPath);
}
function display()
{
//
var xmlTags = xmlDoc.getElementsByTagName('location');
//
for (var i=0;i<xmlTags.length;i++)
{
//
var nodeLoop = xmlTags[i].childNodes.length;
//
for (var ii=0; ii<nodeLoop; ii++)
{
//
var nodeContents = xmlTags[i].childNodes[ii];
//
var nodeLabel = nodeContents.nodeName;
//
if (nodeContents.childNodes.length > 0)
{
var nodeData = nodeContents.firstChild.nodeValue;
} else {
var nodeData = ""
}
//
if (nodeLabel == "id")
{
var dataId = nodeData
}
//
if (nodeLabel == "name")
{
var dataName = nodeData
}
//
if (nodeLabel == "lat")
{
var dataLat = nodeData
}
//
if (nodeLabel == "long")
{
var dataLong = nodeData
}
//
if (nodeLabel == "almstattxt")
{
var dataAlarm = nodeData
}
//
if (nodeLabel == "icon")
{
var dataIcon = customIconPre + nodeData + customIconSuf
}
}
//
AddPin(dataId, dataName, dataLat, dataLong, dataAlarm, dataIcon);
//
//alert(dataId + ";" + dataName + ";" + dataLat + ";" + dataLong + ";" + dataAlarm);
}
}