I'm attempting to use prototype to make an AJAX request to a server-side component that returns valid XML. Everything works as expected with one exception, the responseXML property of the XmlHttpRequest object is not being populated. The responseText property is populated with the text of the XML document, but I need the XML document object that should be available through responseXML. The problem is happening in IE 7. I've tried thiss with Firefox and it works fine, i.e. responseXML is populated. I'm not sure if there is a problem with the response I'm sending or if this is an IE issue. From all that I've read, responseXML should be populated automatically, even in IE, as long as the contenttype header in the response is set to "text/xml" and the XML itself is well-formed. If anyone has any insight or suggestions, I would greatly appreciate the help.
Here is the code from doGet method of the servlet that is sending the response:
The source for the HTML page that makes the request is below:
The xml that comes across is, not surprisingly,:
Thanks, Scott [ November 05, 2008: Message edited by: Scott Escue ]
Thanks, Eric. Indeed it should. It's correct in the original code; I messed it up when I created the simplified example. Unfortunately "request.responseXML.documentElement" returns null. I also checked the "responseXML.parseError" and got a value of 0, which should indicate there were no parsing errors.
Thanks, Bear, that was meant to be a call to setCharacterEncoding. Once I fixed that I noticed that the result of responseXML.documentElement went from null to an empty string (it's been an empty string all along in the original code). That prompted me to try outputing the nodeName of the document element for grins and much to my surprise, and embarrassment, it was "ajax-response".
So it seems my problem for the last day has simply been my own ignorance. I was expecting the output of responseXML.documentElement to be "[Object object]", or at least something other than an empty string. Thanks to you both, though, for helping me realize where I was going wrong. [ November 05, 2008: Message edited by: Scott Escue ]
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad: