This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

why do i get few junk characters in the XML response  RSS feed

 
venkat
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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>");
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
"indianguy guy,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names.

You can edit your display name here. Thank you for your prompt attention!

-Marc
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Report post to moderator
Don't use an ObjectOutputStream - it's meant to be used for serializing objects, not for writing plain text (or XML) files.
 
venkat
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
I need to capture the xml output in another page and unmarshall the xml
code.how can i capture the xml code if i dont use object output stream
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66199
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question in more than one forum. As you have corss-posted this issue in the Servlets forum (which is a more appropriate place than here), I've closed this topic.

Also, see that other post for a message regarding your still invalid display name.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!