Forums Register Login

Generating XML from SQL

+Pie Number of slices to send: Send
I'd like to generate an XML document from a SQL query. Is there a tool that do it easily? How should I do it?

1st step: retrieve the data
....
conn = getConnection();
query = "SELECT * FROM CLIENT";
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
....
2nd step: generate the XML file

I have no idea how to do it. I need your help.
Thanks
+Pie Number of slices to send: Send
Step 3: Profit!

Seriously, you would build up an in-memory DOM using the data you retrieve, then serialize it to the XML file. I am assuming that you are also planning on auto-generating the element names from database and column metadata?

In any case, this is much more of an XML issue than a JDBC one, so I'm going to transfer this over to the XML forum for further discussion.
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 809 times.
Similar Threads
Retrieving xm from mySQL and sending it through webservice method
auto generated unique Id?
Match XML data value with the mysql database
Generating XML from SQL
XML data collection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:18:39.