permaculture playing cards*
The moose likes Java in General and the fly likes ResultSet to XML 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 » Java in General
Bookmark "ResultSet to XML" Watch "ResultSet to XML" New topic
Author

ResultSet to XML

omar bili
Ranch Hand

Joined: Aug 13, 2004
Posts: 177
hi , i need to write my ResultSet in an XML file .
any help would be appreciated
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
There was recently Another Thread about writing a result set to a report. To write XML you'd just have to add some tags around each row & column.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Omar,

Welcome to JavaRanch!

Surprisingly, I don't think there's any standard way of doing this yet. However, this article by Jeff Ryan from developer.com, found by Googling for "ResultSet to XML" strangely enough, provides a rather succinct generic solution. Remarkably simple.

Jules
Maarten Vergouwen
Ranch Hand

Joined: Jan 12, 2004
Posts: 60
I dont know what you are developing, but if you use a DB you might want to explore the possibility of letting the database handle XML generation for you.
I've recently seen this done in MS SQL Server, and it was incredibly easy to do. Instead of writing Java code, just put the functionality into a SP. Has the added advantage of not needing a new software release of something has to change in retrieval of the resultset etc.

rgds,
Maarten
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet to XML
 
Similar Threads
Converting resultset into hierarchical XML
Database to XML convertion
How to know no of records resultset contains in xml file
My Data over The network
How i can use JAXB to convert a ResultSet to XML document?