The moose likes HTML, CSS and JavaScript and the fly likes AJAX request.responseXML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX request.responseXML" Watch "AJAX request.responseXML" New topic

AJAX request.responseXML

pinky suresh

Joined: Jul 21, 2008
Posts: 22
I have a requirement where in on click of a button, I make asynchronous request to a servlet which in turn sends an XML as response, which is then used to update the page without any reload.

But in my AJAX call back method, when I do request.responseXML i am getting blank value.When i give an alert for request.responseText, I am able to see the complete xml content that is sent from servlet in response.

I have checked the correctness of xml file, by running the servlet alone.XML file gets loaded in IE properly without any errors.

I am not able to figure why request.responseXML is not giving me the XML response. Can any one please let me know the mistake/problem that i am facing?

I am using IE6 and Tomcat server with eclipse
Below is the code snippet of my AJAX call back function

function updatePage()
if(request.readyState == 4)
if(request.status == 200)
var xmlDoc = request.responseXML;
alert('after reading response:' + xmlDoc);
alert('responseText: ' + request.responseText);
alert('responseXML: ' + request.responseXML);


XML sent from servlet in simple form is as below:

<?xml version="1.0" encoding="UTF-8" ?>
<address>street 20,California</address>

Please let me know what could be the problem.

[ August 22, 2008: Message edited by: pinky suresh ]

[ August 22, 2008: Message edited by: pinky suresh ]

[ August 25, 2008: Message edited by: pinky suresh ]

[ August 25, 2008: Message edited by: pinky suresh ]
[ August 25, 2008: Message edited by: pinky suresh ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .

[Asking smart questions] [About Bear] [Books by Bear]
Benson Yeung

Joined: Nov 30, 2008
Posts: 1
i have encountered similar problem in IE6, after hours of inspecting, here is the result I found.. hope this can help you

I agree. Here's the link:
subject: AJAX request.responseXML
It's not a secret anymore!