Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic