Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 960642

Pages: 1
Md_sagri
Unregistered




xmlHttp.responseXML is returning null
      #36216 - 09/08/06 03:47 AM

Hi all,
I am new to Ajax and developping a web application on using Ajax.
My script is successfully requesting the server and getting the responseText. But when i want to access the responseXML
it is giving null.
I am recieving XMLHttpRequest.responseXML as null each time I access it, where as XMLHttpRequest.responseText is returning every thing except the xml that I am writing at the server.

My code at server is as follows:
Code:

PrintWriter out = response.getWriter();
String valid;
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
if (user == null) { //checking the availability to update the page.
valid = "true";
request.setAttribute("validity", valid );
String validity =toXml(valid);
out.write(validity);
}else
valid = "false"; request.setAttribute("validity", valid );
String validity = toXml(valid); out.write(validity);



The method toXml is ;
Code:

private String toXml(String v) {
StringBuffer xml = new StringBuffer();
xml.append("<?xml version=\"1.0\"?>\n");
xml.append("<ajax generated=\""+System.currentTimeMillis()+"\" total=\""+0+"\">\n");
xml.append("<validity>");
xml.append(v);
xml.append("</validity>");
// TODO Auto-generated method stub
// Replace println methods to thsi part
return xml.toString();
}



I am expecting my code to return <validity>true or false </validity> on XMLHttpRequest.responseXML.getElemenyByTagName("validity");

Can any one please tell me where am I going wrong.

Thanx & Regards:
Yash(md_sagri@yahoo.com)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 8534

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5