You can't generate an XSD from XML automatically - you wouldn't be able to define the ranges of values possible in an XSD, only reflect those present in the XML document. However, XSD is just XML so you certainly create one with Java.
There are tools out there that can create you an xsd from an example xml file. I've used Trang in the past to do this. Download trang.jar from here
To create the xsd file open a command propt and execute the following (replacing the xml/xsd values) --->
java -jar trang.jar example.xml generated.xsd
This creates you a basic xsd based on the example xml file. It won't be able to know what the restrictions are for individual elements from your example but this is something you can add later if you know them!
we use a tool called Torque (http://db.apache.org/torque) You have your schema in XML and it will generate table Enums and the SQL to generate teh DB. There are also some tasks we have that compare schemas from two db to find the differences.
Check it out. Kinda confusing at first...but really nice!
Joined: Sep 28, 2004
Thanks a lott for all the replies. I just downloaded Stylus Studio, I'll chk trang & Torque today.