Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How i can use JAXB to convert a ResultSet to XML document?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post.
I need to conver a ResultSet to XML document.
i know that JAXB can do this for me , but it needs an XML schema ? for doing this
am i correct ?

in case that it need an XML schema , where i can find that XML schema for resultset ?
Is there an easier framework to use to make this Object<>XML job ?

Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you know what you want the XML for a single result to look like, just write it with print statements.
No need to get complicated, faster, under your direct control, whats not to like?
Bill
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I need to send this XML in a web service to a none java client.
do you have other suggestion for transfering a result set to a none java client ?
I think best way is to serialize it to an xml document anf then transform that document to client side.
Client must recive XML data , nothing else.
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serializing a complete resultset to XML will return a very big and hard to process XML file.
in case that you need the Data that a ResultSet carry , then try to extract the data and create an xml from your Data itself , not from ResultSet.

if you are still looking to serialize your ResultSet , take a look at
http://xstream.codehaus.org/
it is very easy to use framework.
 
deepak reads
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
has anyone tried getting back resultSet back from the xml.we are able to convert the resultset to xml using xstream but getting errors when parsing the xml back to ResultSet
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSet is an interface.

Classes implementing ResultSet would be expected to have some sort of relationship to the underlying JDBC implementation.

Exactly why do you think you need a ResultSet?

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic