[thelist] Loading multiple xml files with javascript?

Diane Soini dianesoini at earthlink.net
Fri Feb 4 21:40:29 CST 2005

Hi, I've asked this before but have had no luck finding an answer, so 
sorry for the repeat. I am having trouble loading multiple xml files. 
It's easy to load just one, but I want to pass in an array, load them 
all and read all the nodes into an array. Basically like this:
load file1.xml, put it's 10 nodes into array. Array length now 10.
load file2.xml, put it's 40 nodes into array. Array length now 50.
and so on...

I have an html page with an onload event handler: 

initialize has a for loop that loops through each xml file and calls 
the standard xml loading script you see everywhere on the web. After 
the xml file loads, the xmldoc is passed to a function that loops 
through the nodes and extracts what I need, putting them into the array.

Unless I put in a bunch of javascript alerts to slow the process down, 
the initialize function loops through before anything gets loaded. I've 
tried setting timeouts and all sorts of things to no avail. Has anybody 
got any experience with loading more than one XML file with javascript?

Basically, I have a whole bunch of xml files I use as databases, each 
one representing a year or a category of data. I want to make a little 
javascript search page to search all these files. I'm not too swift 
with xslt, so please don't say use that instead. I did manage to format 
the xml with xslt into a nice table, but I want to search more than one 
file at a time, so I don't think xslt is going to work.


More information about the thelist mailing list