• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve database records as xml

 
Ameer Joseph
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to implement a method (web service) which returns an xml schema.
In other words the response object of web service will be of type "xml schema".
The records are stored in an Oracle database.

What should be the best way to implement this-

# Option 1. To retrieve the records from oracle simply by calling stored procedures-and then storing in some object- and then converting that object to xml schema. (Not sure exactly how this will work)
# Option 2. Query databse so that it returns xml schema
#Any other option- you can suggest

Thanks in advance for help,
Ameer
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about query database so it returns plain text that happens to be formatted as an XML document?

Bill
 
Ameer Joseph
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill,
Thanks for replying. Can you shed more light on this.

Thanks,
Ameer.
 
Ameer Joseph
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill,
Thanks for replying. Can you shed more light on this.

Thanks,
Ameer.
 
Ameer Joseph
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Bill,
I really appreciate your help. Can you please tell how can we retrieve from database as plain text formatted as xml.
Please provide link/references.

Thanks,
Ameer.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ameer:Can you please tell how can we retrieve from database as plain text formatted as xml.

For that you first have to tell us, what format is the data stored in the database.
Nothing will magically change the data in the database to an xml document. There needs to be some piece of code, either yours or third party that will help you do it.
 
Ameer Joseph
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Nitesh,

Thanks for replying. The records are stored in an Oracle database in the 'usual data'format like varchar, number and timestamp for date. I am not sure what we call this format.
Please read my original post which explaines what I want to do.
I appreciate your help. I could not figure out what Java Code/XML Code /Third party code can be used for it. It will be great if you provide some references and Also if this is the best way to do it.

Thanks a ton,
Ameer.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We appear to finally have established that you have a database with a variety of fields and want to do a query that outputs an XML formatted text stream.

Your use of the term "return an xml schema" had me confused, I am now assuming you mean that the output XML must conform to a schema rather that write a schema document. If you really want to write a schema document than the following will not help.

The ServingXML toolkit is supposed to be able to make turning SQL queries to XML easy.

Bill
[ April 26, 2008: Message edited by: William Brogden ]
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Hibernate Framework has a function that will extract relational data and create an XML-based representation of it. Below is a code fragment that extracts a User record and returns an XML data set.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic