• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML output shown as plain text

 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
reply
    Bookmark Topic Watch Topic
  • New Topic