Here I try to access two third party API i got two xml response so i merge that in single file and make store in local system,if i print output in console means it gives xml format output but i want to print in browser it won't work please help me to find solution i post my code here
Jeanne Boyarsky
,
author & internet detective
staff
Would it be correct to assume that you are using a browser to observe the result of that code? (You were kind of vague, only saying "it display".)
I don't see you telling the browser to expect XML anywhere in that code. So probably the browser is expecting HTML, and ignoring any elements which it doesn't recognize. You might consider using the browser's "view page source" to see what the browser actually gets, as opposed to how it interprets what it gets.
Durga Roobini wrote:ya i agree what you saying, so it is not recognize my xml file ,means there is no other way to display my xml file in browser
Sure, you just have to set the content type appropriately.
actually what i need is i want to send this xml file to client (phonegap) , there i actually parse the xml so am using jquery ajax function
In which case you don't actually need to deal with the browser at all. So stop worrying about the browser because it isn't part of your problem.
it is possible any other way to send my xml file to my client
That IS the way to send the XML to the client, assuming that the request came from the client. You're just confused because you happened to choose a bad tool to test with.
* in my first case i have to set, response.setcontenttype("text/xml"); please check my above codings and tell me where i correctly insert this code,even i try this three places alternatively it wont work
* tell me the way or some samples to send xml file to client from servlet
Again, explain what you mean by 'it won't work'. Did you write the client part that is supposed to read that xml? Did you get an error on the phonegap application when you tried to readthe XML? Or what happened exactly?
it wont work means it gives only text output but not xml format output
in client side using
$.support.cors = true;
$.ajax({
type: "GET",
url: 'http://10.0.2.2:8080/sucess/ThirdServlet',
data:{
val:val,
},
dataType: "xml", //here am using datatype:text means it print text from servlet output else it returns null value
success: function(data) //it goin in sucess part
{
// i print data here it returns null because my servlet browser have text but above i mention datatype:xml so it returns null [so only i want xml output in browser means client side problem will clear]
/// parsing xml codings
},
error:{.....},
});
please help me soon am struck here long time
Post by:autobot
You can't expect to wield supreme executive power just because
a bit of art, as a gift, the permaculture playing cards