Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Getting responseText instead of responseXML
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Parixit  
View profile  
 More options Sep 28 2008, 8:26 am
From: Parixit <parix...@gmail.com>
Date: Sun, 28 Sep 2008 05:26:43 -0700 (PDT)
Local: Sun, Sep 28 2008 8:26 am
Subject: Getting responseText instead of responseXML
Hi guys, i am getting responseText instead of responseXML from the
servlet eventhough i hv specified the content type as "text/xml" and
also using out.write() command. This is what i am getting in IE but in
Firefox 3 i get readystae code as undefined after 1 while in IE i get
all the codes right.

below is my servlet code for doGet

protected void doGet(HttpServletRequest request, HttpServletResponse
response)
   throws ServletException, IOException {

           response.setContentType("text/xml");
           response.setHeader("Cache-Control", "no-cache");

           PrintWriter out = response.getWriter();

           try
           {

                   //con = openConnection();
                   con = connectionPool.getConnection();

                   out.write("<?xml version=\"1.0\"?>");
                   out.write("<markers>");

                   out.write(queryDB(con));

                   out.write("</markers>");
                   out.close();

                   //out.close();
                   //closeConnection(con);
                   connectionPool.free(con);

           }
           catch (Exception e)
           {
                   e.printStackTrace();
           }
   }


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phill-X  
View profile  
 More options Sep 30 2008, 5:48 am
From: Phill-X <gllphill...@gmail.com>
Date: Tue, 30 Sep 2008 02:48:13 -0700 (PDT)
Local: Tues, Sep 30 2008 5:48 am
Subject: Re: Getting responseText instead of responseXML
Hi Parixit,

To get a exact responseXML for HttpXMLRequest you must send an XML
from the server side. I mean without any errors. For an example, in
theample code you have given doesn't have ending tag for XML tag (</
xml>) . And make sure the generated string by queryDB(con) doesn't
have symbols like "&". If you have it you have to use CDATA to pass
those strings. Otherwise XML will fail.
The code you have given is a serverside code. So it will be totally
independent on what browser you are using. To further problems to be
identified you must give us some client side codes like Javascript and
HTML etc (if that problem still exists).

Thank you.

On Sep 28, 5:26 pm, Parixit <parix...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Parixit  
View profile  
 More options Sep 30 2008, 1:35 pm
From: Parixit <parix...@gmail.com>
Date: Tue, 30 Sep 2008 10:35:29 -0700 (PDT)
Local: Tues, Sep 30 2008 1:35 pm
Subject: Re: Getting responseText instead of responseXML
thanks phill i got around the xml problem but firefox is still giving
me problems. if i try to execute the script in firefox with firebug by
setting the brekpoints then i aactually get the valid readystate codes
but if the page is just fetched normally reaadystate code 2,3,4 are
all replced by 'undefined'. here is the client side javascript code

window.onload = makeRequest();
var xhr = false;
var map;
var z=0;
var tm=0;
function makeRequest() {
  alert("l0");
  var url="http://csci571.usc.edu:10968/examples/servlet/xmlGenerate";
document.getElementById("msgArea").innerHTML = "Loading........";
if (window.ActiveXObject) {
        z=1;
        try {
        xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
                        try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
                        catch (e) { xhr=false;}
                }       }
                else{
if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
        z=0;
        xhr.overrideMimeType('text/xml');
        alert("LLOOK");
  }
  }
alert("lf");
  if (xhr) {
        xhr.open("GET",url, true);
        xhr.onreadystatechange = function() {
          showContents();
          };
        xhr.send(null);
  }
        else {   alert("le");
        //document.getElementById("messageArea").innerHTML = "Sorry, but I
couldn't create an XMLHttpRequest";
        }
  }

  function reftdata() {
  var url1="http://csci571.usc.edu:10968/examples/servlet/
xmlGenerate";
        alert("lrr");
        if (xhr) {
        xhr.open("GET", url1, true);
        xhr.onreadystatechange = function() {
          showContents();
          };
        xhr.send(null);
        //setTimeout("reftdata()", 200000);
  }
        else {   alert("lre");
        //document.getElementById("messageArea").innerHTML = "Sorry, but I
couldn't create an XMLHttpRequest";
        }
        }

function load() {
<some code>
      }

function showContents() {
if (xhr.readyState == 3) {
document.getElementById("msgArea").innerHTML = "Recieving........";}
  alert("KKK :"+xhr.readyState);   ///
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<this alert gives me 'undefined'
after readystate 1. and there are lot of alert
                                                 ///////////////////////////////////////////////////////
at   this point when undefined comes. as is it hs got tuchk in a
infinte while loop.
        var outMsg="";
        var i=0;
        if (xhr.readyState == 4) {
          //alert("l3");
xhr.responseText;
                if (xhr.status == 200)
                {
<some code>

}}}

On Sep 30, 2:48 am, Phill-X <gllphill...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google