This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes How can servlets  sent  XML files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can servlets  sent  XML files?" Watch "How can servlets  sent  XML files?" New topic
Author

How can servlets sent XML files?

Jim Smithian
Greenhorn

Joined: Sep 21, 2004
Posts: 18
I am writhing some servlets which allows users to store and retrieve information in MySQl database. I am using TOMCAT 5.0.28 and J2EE.
I have the following questions:

1-How can I put the result of SQL queries into a XML file and validate it? I have the DTD file.

2- How can I put XML and XSL files into an html response and send it to the browser? Browser will transform XML into HTML using my XSL file.

Can anybody explain to me or refer me to somewhere where I can find how to do those.

Thanks.

Jim
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
1. If your database doesn't do this for you, you'll have to do it yourself the good-ol' fashioned way (with code).

2. There's a directive that is used in the XML response which indicates to the client that it should transform the XML document instance. Use something akin to "< ?xml-stylesheet type="text/xsl" href="example.xsl" ?>" to do this (at the top of your XML response. Be sure you set the content type to whatever mime type xml is "text/xml" maybe?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
 
 
subject: How can servlets sent XML files?
 
Similar Threads
Example: XML + XSL = HTML Using Servlet
XML, XSL URI
Associating 1 XSL file with many XML files
using .xml and .xsl file in Servlets/jsp files to generate .html content (to browser)
XML+XSL with Java servlet