• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How can servlets sent XML files?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic