View Full Version : newbie in too deep - including xml?

05-08-2006, 05:46 AM
I am trying to load an xml file and read its content into my javascript array... without success thus far.

The tests.xml looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<QUOTES>queote 1 blah balh</QUOTES>
<QUOTES>queote 2 blah balh</QUOTES>
<QUOTES>queote 3 blah balh</QUOTES>

I want to take the 'QUOTES' data and put it into my testimonialArray().

Here is what I've got so far.

if (window.ActiveXObject) {
var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument) {
var xmlDocument = document.implementation.createDocument("", "", null);

var testimonialArray=new Array();
testimonialArray[0] = xmlDocument.getElementsByTagName('TESTIMONIALS').item(0);
testimonialArray[1] = xmlDocument.getElementsByTagName('TESTIMONIALS').item(1);
testimonialArray[2] = xmlDocument.getElementsByTagName('TESTIMONIALS').item(2);

I've tried using 'QUOTES' as tag name and using childNode and firstNode; everything returns null. Seems like this should be simple haha.

Any help would be greatly appreciated.