Forums Register Login

Xml output Print in Browser

+Pie Number of slices to send: Send
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


+Pie Number of slices to send: Send
What do you mean by "it doesn't work." Does it throw an exception? Display the wrong output? Do something unexpected like download the file?
+Pie Number of slices to send: Send
Means it display only text output without xml tags.i want to display xml file format in browser
1
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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

* 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

* inside of jquery-ajax i use sucess: function(data)-receive my xml file from servlet


* it is possible any other way to send my xml file to my client
+Pie Number of slices to send: Send
 

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.

+Pie Number of slices to send: Send
* 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
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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
You can't expect to wield supreme executive power just because
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3325 times.
Similar Threads
Can I get stream for uploaded file in struts 2?
Onchange JCombobox
How to compare two huge xml files
Is this Dao?
JMF Problems with cut.java sample
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:19:27.