Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XML display in the browser without creating the XML file  RSS feed

 
anand tiwari
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my web application, i am getting the data from the database and generating an XML file based on that. This file is created, read and its content is displayed in the browser when the user clicks a specific link on the web page.

As per the new requirement, i am not supposed to generate the XML file. Instead when the user clicks on the specific link on the web page, the XML should get displayed in the browser directly without generating the XML file.

Can someone please help me in how to do this?
Moreover, this XML generation application should support multiple clients. Do i need to make my application thread-safe explicitly even though i am using a servlet to do this?

Please suggest

Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write it to work the way a typical servlet outputs HTML.

out.println("<xml..../>");
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you creating the "XML file" in a sequence of writes or printlns? If so you just need to output to the servlet response output stream like Ben said.

If you are creating an in memory DOM and transforming to write the file? If so, just transform to the response output stream.

You do need to think about Thread safe code - mainly make sure each request gets its own XML creating object.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!