The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes XML response from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic

XML response from servlet


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>."+
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

You should try the servlets forum for better results

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63851

This question has already been posted on three other occasions. This topic is closed.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: XML response from servlet
It's not a secret anymore!