jfields026 Posted February 10, 2011 Share Posted February 10, 2011 I've written a page that uses javascript to poll a php page which sends a soap request to the national weather service. The php page then receives a response and relays that back to the original webpage via xml. The webpage then parses the xml and update the webpage with the new information. (The Website is http://www.orbitalspeeds.com/Test/Trips.html with the error showing up when I click "Show Points") My page works great in Firefox, Chrome, Opera, and Safari but I cannot get it to work in Internet Explorer (tried IE7 and IE8). I believe it has something to do with how IE is retrieving or parsing the XML. When I have some IE error checking turned on I get an "Invalid at the top level of the document" error. Also, IE is also showing errors on certain lines that ultimately relate to empty strings which should be full and are full when using other browsers. Instead of including 1000 lines of code I am including the URL to the site and you can "View Source". I've also turned on some alerts that display the returned xml and one location where I try to parse. The parsing location begins at line 515 of the html with an example shown below.<code>str = xmlDoc.getElementsByTagName("location");alert("Number of locations " + str.length);</code>In every browser except IE I get a number. Also, in every browser but IE I get the XML displayed (just hit enter on the XML display to get it to go away), IE only shows the words "Array" without any XML. The php call is at line 461<code>xmlhttp.open("GET","http://www.orbitalspeeds.com/Test/wx/pull.xml?startdate=" + startdate + "&enddate=" + enddate + "&thesepoints=" + polledLatLongs, true);xmlhttp.send();</code>The return is right below it at line 466<code>function loadXMLString(xmlreturn){if (window.DOMParser) { parser=new DOMParser(); xmlDoc=parser.parseFromString(xmlreturn,"text/xml"); }else // Internet Explorer { xmlDoc=new ActiveXObject("Msxml2.DOMDocument.6.0"); xmlDoc.async="false"; xmlDoc.loadXML(xmlreturn); if (xmlDoc.parseError.errorCode != 0) { var myErr = xmlDoc.parseError; alert(myErr.reason); } else { objNodeList = xmlDoc.getElementsByTagName("location"); for (var i=0; i<objNodeList.length; i++) { alert(objNodeList.item(i).xml); } } }return xmlDoc;}</code>You'll probably notice that I am using "Msxml2.DOMDocument.6.0" for the IE loadXML, I've also tried "Microsoft.XMLHTTP" (and many other versions) with the same results. Additionally, sometimes on the first time that you run the page you get no result, just reload it and run it again (click Show Points). I haven't figured that bug out yet either.The Website is http://www.orbitalspeeds.com/Test/Trips.htmlThe returned xml can be seen by running the page.The error I am getting is when I click "Show Points".Please try it both in IE and some other browser to see the different results.Thanks so much for your help, I've been trying this for days.JeremyAlso, you'll notice this error message in IE, it is referring to an array that should be full if the XML is parsed correctly.Message: 'wxiconsinfo.0' is null or not an objectLine: 325Char: 5Code: 0URI: http://www.orbitalspeeds.com/Test/Trips.html Link to comment Share on other sites More sharing options...
jfields026 Posted February 12, 2011 Author Share Posted February 12, 2011 This has something to do with how IE is handling time in my request, I'm working on it. I don't think it has anything to do with the parser but rather the inputs to the php request which is invalid due to the time. I'll update when I figure it out. Link to comment Share on other sites More sharing options...
jfields026 Posted February 12, 2011 Author Share Posted February 12, 2011 So I had an option box with times in it and I was using that time for my php request. IE doesn't pull a value with <code> thisdate = document.calendarPart.Select1.value; </code> when the option box is set up like <code> <option>1 am</option> </code>. It needs to be <code> <option value="01:00:00">1 am</option> </code>. Also, there is some differences in the way IE handle date / times versus other browsers. For example IE recognizes <code> var myDate = new Date(somevalue); </code> as "Sat Feb 12 2011 08:00:00 GMT-0700 (Mountain Standard Time)" whereas other browsers see "Sat Feb 12 08:00:00 MST 2011". I was parsing the date/time but was having problems because of the different formats. I got it fixed now if you want to try it out. I'll be making revisions but it's working and now located at http://www.orbitalspeeds.com/ThanksJeremy Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.