Getting HTMLUnknownElement with jQuery.find() and an XML Document

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2009-03-09T01:32:15Z Indexed on 2010/04/02 20:23 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

I'm attempting to load up an XML document (specifically an RSS feed) via an Ajax request, parse it, and insert some information based on said feed into my page. The code works fine in Firefox, Opera, Chrome, and Safari, but not IE7. Go figure.

After doing some initial debugging, I've found that the XML string is being retrieved via the request, and the specific node type I'm getting when trying to parse nodes out of the document is HTMLUnknownElement.

Here's the relevant code:

$.get('feed.php', function(oXmlDoc) {

    var titles = $(oXmlDoc).find('title');
    var dates = $(oXmlDoc).find('pubDate');

    for(var i = 0; i < 5; i++) {
        parseNodes(titles[i].firstChild.nodeValue, dates[i].firstChild.nodeValue));
    }

});

The parseNodes function is never actually being hit because IE cannot access firstChild and, consequently, nodeValue.

Thanks in advance for any ideas and/or suggestions on how to address this.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX