Guest Jannigje Posted September 13, 2006 Share Posted September 13, 2006 The example of loading and reading an XML file in FireFox op page http://www.w3schools.com/dom/dom_parser.aspdoesn't work with FireFox on my pc: always "no elements found" in file.The solution is to adjust the code for FireFox to something like this: else if (document.implementation && document.implementation.createDocument) { // Mozilla-type browsers xmlDoc=document.implementation.createDocument("","",null); if ( true == xmlDoc.load("test.xml") ) { setTimeout("showData()",100); // delay until doc is loaded } }Apparently, the thing is that the file is read before it is entirely loaded, so nothing is found.In the code above I have - rudely - build in a delay before the reading and showing of the contents,hence the example works.W3Schools has fantastic JavaScript examples, but this one just didn't work without the fix above.Very, very frustrating.Regards,Jannigje Link to comment Share on other sites More sharing options...
boen_robot Posted September 13, 2006 Share Posted September 13, 2006 What version of Firefox are you using? Both examples on the page you gave work on my Firefox 1.5.0.6. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now