|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
response.setContentType("text/xml")
Hi,
I am trying to ouput some xml onto my Browser (IE 6) and my code reads like this: response.setContentType("xml"); PrintWriter out = response.getWriter(); out.print("<?xml version='1.0' encoding='ISO-8859-1'?>"); out.print("<greeting language=\"en_US\">"); out.print(" Hello, World!!!!!!!"); out.print("</greeting>"); Pretty simple u cud say.. but what happens is the servlet somehow parses the xml and prints only the values between the tags greeting!! However if i do a view source on the browser the xml tags are visible fine!! Any ideas why the xml tags dont appear on the browser?? thnx, sgaucho |
|
#2
|
|||
|
|||
|
Try "text/xml" or "application/xml" instead of just "xml" for your mime type. The problem isn't with the servlet, the problem is the browser interpreting your content as html or xhtml and trying to display the contents without the markup.
|
|
#3
|
|||
|
|||
|
hi,
i originially tried with text/xml but wouldnt work either... furtehr whats strange is that i closed the browser window and opened it again and voila the xml showed up allright but the same problem occured a few mins later!! an more suggestion??? thnx, sands |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > response.setContentType("text/xml") |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|