QuantumDoja
Programmer
Hi, I have some code that is supposed to load some xml in either IE or mozilla and count how many categories there are from an xml file, it works fine in IE, but in mozilla it returns zero. any ideas?
my example xml
Code:
<script language="JavaScript">
var xmlDoc;
function importXML(file) {
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');
if (moz) {
xmlDoc=document.implementation.createDocument("", "", null);
xmlDoc.async = false;
} else if (ie) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
while(xmlDoc.readyState != 4) {};
}
xmlDoc.load(file);
}
importXML("StarterXML.asp");
Category = xmlDoc.getElementsByTagName("CATEGORY");
alert(Category.length);
</script>
my example xml
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ROOT>
+ <CATEGORY>
+ <CATEGORY>
+ <CATEGORY>
- <CATEGORY>
<ID>103</ID>