File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "response from servlet of xml format" Watch "response from servlet of xml format" New topic

response from servlet of xml format


Joined: Feb 03, 2007
Posts: 5
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.


OutputStream outputStream = response.getOutputStream();
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>."+
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62275

"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.

JavaRanch Sheriff

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: response from servlet of xml format