This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes response from servlet of xml format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "response from servlet of xml format" Watch "response from servlet of xml format" New topic
Author

response from servlet of xml format

venkat
Greenhorn

Joined: Feb 03, 2007
Posts: 5
hi,
i am trying to get a xml response from a servlet.I am getting the xml
as response from servlet along with some junk characters.Kindly tell me
how can i avoid the junk characters as i need to marshall this stream.

response.setContentType("application/x-java-serialized-object");

OutputStream outputStream = response.getOutputStream();
System.out.println(outputStream);
ObjectOutputStream output = new ObjectOutputStream(outputStream);

output.writeObject("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<text timestamp=\"08:45:00.000\">"+
"The deadline of <name>homework 1</name> is"+
"<emph>March 9th 2001</emph>."+
"</text>");
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

"venkat", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: response from servlet of xml format
 
Similar Threads
junk characters in xml response
XML response from servlet
why do i get few junk characters in the XML response
save a xml file using java
Customizing Epic Editor