Click to See Complete Forum and Search --> : Mysterious exit using load on XML


ShawnGarbett
12-05-2003, 09:28 AM
I've got some JavaScript for doing dynamic HTML based on a set of XML files. It loads an XML file and parses it, then based on that it loads and parses another one, till it gets what it wants built up and then dynamically adds it to the page. I call the parser using "document.onload". Full source code available at
jsFind (http://www.elucidsoft.net/projects/jsfind).

It sometimes mysteriously exits with no reason. No javascript errors occur, nothing. I tried capturing exceptions to no avail. The exit is cross platform as well, under different implementations of JavaScript. So I suspect that something is wrong with my script.

I tried the following fix and it didn't work either. I added a watchdog timer to timout after 10 seconds, if it wasn't disabled. This watchdog could then restart the parse. At least that was my idea. The watchdog never gets called (It does get called if I don't call the parse and put in a big loop). JavaScript has stopped mysteriously, and I get no error message, exception or means of recovery.

Any ideas how to fix/debug this? Anything?

Khalid Ali
12-06-2003, 07:32 AM
it sounds like jas code that spits the results does not finnish and breaks in between...make sure that your XML does not have a charcter that could cause the browser parser to crash.

ShawnGarbett
12-06-2003, 05:10 PM
Well I forgot to mention, it works if one hits reload. Everytime. It's like the file is in cache and then it has no problem running to completion. I don't think it's an invalid character, the files are auto-generated and the code to generate them is trival. The content however can grow long.