views:

468

answers:

2

Is there a tool that directly maps XML structure to database schema?

The reason I ask this is because my data is best described in terms of XML structure. However, I want to store them in database for fast query result and other benefits.

A: 

have a look at xmlspy from altova www.Altova.com/XMLSpy i believe this tool could help you. (this is not an advert!!)

karlis
+2  A: 

I was on a Java project that had the some requirements and we found that HyperJAXB was a good fit. It uses JAXB to get from the XML schema to Java objects and then uses Hibernate to persist the Java objects. The latest version works with anything that supports EJB3/JPA as well.

Normally it does this without producing the database schema file but you can make Hibernate spit it out if you need it. Because the schema automatically produced it can look a little ugly until you work out why it's done the way it's done.

If you aren't using Java but you'd be willing to use something similar to HQL (Hibernate Query Language) to access the database then you could use it to make an XSD to DDL converter since the generated schema is created with HQL style operations in mind. If that doesn't sound ugly enough you could turn up the hibernate logging and see what SQL it generates for various HQL queries and use that to make sure that you're getting the access patterns right.

So basically it's not a good fit for anything but Java :)

Dave