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:
> 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:
> > 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();
> > }
> > }- Hide quoted text -
> - Show quoted text -