• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can we retrive XML data in JSP?

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have created an XML containing some data
Now i want to retrive that data and show it in JSP
previously I use to retrive same data through database
so it was simple to show it on JSP
but I donot know how to retrive it through xml
moreover i have to update as well as delete the data in XML from JSP itself
can anyone suggest me how shall i go ahead
any sites or articles that may be useful??

waiting for anyone's suggestion
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would probably put XML data into a DOM object that has session scope. THen in your JSP page, use XSL to transform your DOM object into HTML. If something needs to be deleted, then use the DOM methods to delete from the DOM tree. WHen you go back to the page, you should be able to use the same XSL then to redisplay the page. Since you removed things from the DOM tree, then they won't get displayed!
Here is a link that may be useful. http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-xpath.html
HTH
BRian
 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx Brian
but is there anyway if we are doing SAX parsing
because I have done through that way only

how can we update and delete if we use SAX parsing technique?
any suggestions?

Originally posted by Brian Nice:
I would probably put XML data into a DOM object that has session scope. THen in your JSP page, use XSL to transform your DOM object into HTML. If something needs to be deleted, then use the DOM methods to delete from the DOM tree. WHen you go back to the page, you should be able to use the same XSL then to redisplay the page. Since you removed things from the DOM tree, then they won't get displayed!
Here is a link that may be useful. http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-xpath.html
HTH
BRian


 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not write a bean which uses SAX tp parse your XML and provide bean accessors for all the important data. Then it is easy to provide a similar bean to provide the same accessors but retrieve its data from the database instead. You can then choose where and how you get your data without changing and recompiling the JSP.
It is, in general, a bad idea to build in data structure or data source dependencies in to a JSP.
reply
    Bookmark Topic Watch Topic
  • New Topic