xml parse error when using $ajax to load a file: url on IE
|Reported by:||karger||Owned by:|
|Keywords:||ie xml parse error||Cc:|
I've asked about this before but have more facts and a more detailed example. I've got a script that uses $.ajax to fetch an xml file (and specifies dataType "xml"). Under firefox it works perfectly, whether the html and xml files are remote (http url) or local (file: url). Under IE, if the files are remote, everything is fine. But if the files are local, then although the fetch is successful, jquery's internal httpData method fails to parse the xml, and instead invokes the $ajax call's error method and returns a "parseerror" message.
You can find a sample demonstrating the error at http://people.csail.mit.edu/karger/Jquery/XML/test.html that loads a test file at http://people.csail.mit.edu/karger/Jquery/XML/test.xml . It works fine if you access it there, on FF or IE, but if you download the two files and try to load from your local copy, FF works but IE fails with a parseerror. If you change the dataType argument to html, IE will work locally---this shows that the ajax call is successfully fetching the file on IE, but is failing to parse it properly.
So apparently the inconsistency is somewhere inside jquery's httpData parser method, which is territory I'm not equipped to explore. If anyone can help me out, I'd appreciate it.
My backup plan is to change the returned datatype to html, but since the file being loaded is xml this seems like a cop-out (and one that will have trouble with namespaces and will worsen performance when I try to run selectors over the result, right?)