aspose file tools*
The moose likes XML and Related Technologies and the fly likes How to read from XSD generated database and put that data into XML file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to read from XSD generated database and put that data into XML file." Watch "How to read from XSD generated database and put that data into XML file." New topic
Author

How to read from XSD generated database and put that data into XML file.

Kjeld Sigtermans
Ranch Hand

Joined: Aug 10, 2006
Posts: 122
Hello.

I am creating a batch tool that must read data from a database, and put this data in a XML file, which is the application output.
Goal: the XML file contents must be a representation of the data contained in the database.

Starting point is a XSD file I have, which acts as a schema definition for both the database and XML file. First, I generated the database tables using a tool called XSD2DB which generates database tables based on the XSD.
Next, I have used JAXB xjc to generate Java classes based on the XSD.

Another process inserts the relevant data in the database.

Up until now I have instantiated one or two of the generated classes, read some data from the 'reflecting/accompanying' tables in my database, and I finally marshalled the objects to a XML file.
Since the XSD (and the database and XML file for that matter) is pretty large, I wonder if there is any way the database contents can be put in the XML, without having to populate my java objects explicitly. Lazy as I am, I'd like to use some sort of tool that automatically copies the database data to the XML file. While writing this, I am thinking of using Hibernate (JPA) and then JAXB marshalling as a two-step process.

Alternatives, ideas or insights are much appreciated.
Thanks!

Kjeld Sigtermans - SCJP 1.4 - SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to read from XSD generated database and put that data into XML file.
 
Similar Threads
Java-XML Binding with Facet Enforcement
Newbie question - conversion of incoming XML document into generated object graph
Autogenerating Castor Unmarshaller Mapping File
Facade design pattern in web services
my package doesnt contain ObjectFactory.class or jaxb.index