Thank you very much, Brett, worked like a charm! Guess I was googling on the wrong issue. For all, here is the revised script:
<html> <head> <title>Read XML</title> <script src="lib/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ // Changes start here $.ajax({ type: "GET", url: "file:unk.xml", dataType: ($.browser.msie) ? "text" : "xml", success: function(data) { var xml; if (typeof data == "string") { xml = new ActiveXObject("Microsoft.XMLDOM"); xml.async = false; xml.loadXML(data); } else { xml = data; } // Changes end here, plus one extra closing brace below var DBArea = ''; // This displays the values from the XML file DBArea += "xml = :" + xml + ":\n"; // I get blanks here DBArea += "$(xml).text() = :" + $(xml).text() + ":\n"; // The following gives [Object Object] var ph_sites = $(xml).find('product_header_sites'); DBArea += "$(xml).find('product_header_sites') = :" + ph_sites + ":\n"; // And the following gives blanks too ph_sites = $(xml).find('product_header_sites').text(); DBArea += "$(xml).find('product_header_sites').text() = :" + ph_sites + ":\n"; // Update the DIV called Content Area with the HTML string $("#DebugArea").append("<pre>" + DBArea + "</pre>"); } // end success function }); // end ajax function }); // end jQuery function </script> </head> <body> <div id="DebugArea"></div> </body> </html> Thanks again, Doug -----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Brett Ritter Sent: Thursday, September 10, 2009 9:18 AM To: jquery-en@googlegroups.com Subject: Re: FW: [jQuery] Re: Newbie: Cannot get .text() to work with IE7 On Thu, Sep 10, 2009 at 8:21 AM, Knight, Doug <dkni...@mitre.org> wrote: > Sure could use some help on this one. Does anyone on the list have any clue > why the .text() function works differently between FF and IE7? I've Okay, so here's the basics: It isn't .text(), that's just showing the problem. The problem is your $(xml) call. As I understand it, Jquery relies on the underlying DOM parser of the browser. Non-IE browsers handle XML casually, IE browsers are more specific. (as easy as it is to rip on MS/IE, I'm not convinced the IE behavior is wrong, per se, but it's clear that being right doesn't make things easier). Google for "JQuery IE XML Parsing" returns a fair number of hits on this if you want to delve in deeper. Sadly it looks like the answer is a little complicated. http://docs.jquery.com/Specifying_the_Data_Type_for_AJAX_Requests The above link covers your exact case and shows a work around for loading local files - it may behave differently on a server. I've not played with it myself as of yet. Sorry you didn't get a faster response. -- Brett Ritter / SwiftOne swift...@swiftone.org