aspose file tools*
The moose likes JSP and the fly likes JSTL SQL XML data source / driver? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL SQL XML data source / driver?" Watch "JSTL SQL XML data source / driver?" New topic
Author

JSTL SQL XML data source / driver?

Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
How would a JSTL SQL XML data source look like and what driver would i need? Or how to access an XML data source using JSTL SQL tags?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Hi Tudor, here is an example of an XML data source which was extracted from this page http://java.sun.com/products/jsp/html/JSPXML.html





I am not sure how JSTL would handle the XML and what 'driver' it would use. I have never combined JSTL / SQL / Data sources together since I feel mixing the view with data handling logic is a bad idea. However I can take a guess

The JSTL probably handles the XML through a DOM parser and select statements are translated to XML XPATH expressions. For example select * from books where title='Web Servers for Fun and Profit' is probably translated to something like /books/book/title[text()='Web Servers for Fun and Profit']

Can you handle the XML data elsewhere and simply bind the data that the view is supposed to show ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
Thank you. A JDBC example would work as well. I use both JSTL SQL tag and JDBC for simple and complex tasks respectively. For example i'm using the JSTL SQL tag to get a count of rows and display it in my input's value as a starter value for client's convenience. I think it's closer related to the view than model in this case - ti also doesn't matter much if it stops working, and i almost guarantee i won't need maintenance and wouldn't brake before JDBC model database access.

I also been searching and found this: https://xlsql.dev.java.net/
Haven't tried it but it should also do the job:
xlSQL is a JDBC Driver for Excel ( CSV, XML and other ) document data sources.


I will try them both as soon as i get the chance. Glancing through that example i see is a MVC one. I also can do what that example can, but trying to do it through an API to look simple.

The purpose is packaging everything into a war (for portofolio), so i don't have to make the people see it set up a database and configure Tomcat as well. All they would need to do is drop the war in Tomcat. I find it strange that there wouldn't be a driver for excel and flat files.

EDIT1: This might lead to what i'm looking for also:
http://ireport.sourceforge.net/cap7.html
EDIT2: Also this:
https://www.hibernate.org/218.html
and these two might do too:
http://jibx.sourceforge.net/
http://xmlbeans.apache.org/

I think i might use hibernate though, looks promicing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL SQL XML data source / driver?