aspose file tools*
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
Author

XML response from servlet

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>");
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

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
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML response from servlet