views:

73

answers:

1

Hi All,

I have created an extension for mediawiki that works in all major browsers other than IE (any version it appears). The extension relies on mediawiki's ajax wrapper to send an xmlhttprequest with parameters that essentially build a database query to a php script. This script will run a query based on the parameters and then create an XML object (using php's simplexml class) which then returns the XML to javascript for display in the browser (just a table, mostly).

Now with all that information, IE seems to be working up until the point at which it tries to parse the returned XML. I have set the mime type to application/xml and I have tried loading it with various different techniques found via google (none worked).

It is trivial to load the XML for parsing when using non-IE browsers:

function callbackHCL(response){
    if (response.readyState == 4) {
        var xmlObj = response.responseXML;
            if (response.status == '200'){
                if (xmlObj !== undefined){
                    //etc...

Now I can start using dom functions to get at data.

My Question: Does anybody have any suggestions on how to parse xml in IE based on my current scenario?

If you would like to email me at [email protected], I can provide longer code snippets, they are longer and I don't believe they would help the situation. If you would like me to post more code, just ask as well.

Thanks in advance, Tim

A: 

I think this might be what you want: http://dean.edwards.name/weblog/2006/04/easy-xml/. Basically, IE doesn't return an XML document like the other guys. Need to do a little fancy footwork to make it work correctly. I'm sure there's a library out there that wraps this all up so you don't have to worry about it if you don't want to.

Bialecki
Thank you bialecki. That is very similar to something I found while searching, but does explain things better. it doesn't fully solve my problem, but gets me a bit farther. With Dev tools on, I can look at the my "Locals", but under childNodes.item, it says "invalid number of parameters". I use childNodes in my JS and hope that if I solve that problem, then I'll be all set. I'll look that up in the meantime, but any further guidance or links you have would help immensely.Thanks
TIm
Can you show me the snippet of JS that doesn't work and also give me an idea of what the XML response looks like?
Bialecki
AHA! I used your solution and then found out that it isn't the childNodes issue but instead I was using object.textContent. Instead of that I used object.firstChild.data. Voila, it works like a charm. Thank you so much for your help, Bialecki.
TIm
np, glad it worked.
Bialecki