• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML output shown as plain text

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which build an XML document on the fly.

My problem is that the servlet shows the xml data as plain text. Instead I want it to show a the contentType text/xml.

I have tried to set the contentType in the servlet:
response.setContentType("text/xml; charset=ISO-8859-1");

- but it doesn�t help.

Here is where I create the output:



How can I set the contentType so the output is shown as text/xml?
 
Ed Ward
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may just be me, but what do you mean when you say the servlet shows the data as plain text?
What are you outputting to?
A browser, a file, a console window.

Maybe if you provided a sample of the output?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried the content type without the encoding? ie "text/xml"
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay I don�t have the problem anymore. And I don�t know why, because I haven�t changed anything in the code. Strange! But thanks anyway.

"Yes I was outputting to the browser".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic