Cheese Daneish
Cheese Daneish

Reputation: 1030

Reverse engineering java objects into an xsd

What is JAXB and why would I use it?

This fellow mentions some frameworks that allow you to go from java binding objects and re-create the schema that generated them. Does anyone know if this is possible with the Castor binding tool? We are using version .9 something.

Someone modified one of our .xsd's, and never checked in the file. A significant amount of code was then created using the objects from the updated schema that was never checked in. Now that file appears to have gone MIA.

Upvotes: 0

Views: 800

Answers (1)

Ravi Wallau
Ravi Wallau

Reputation: 10493

I am not sure if I get what you want - you want to generate the XSD from a Java class? I didn't use Castor, I used JAXB, but it is pretty simple:

%JAXB_HOME%\bin\schemagen.bat -d .\ -cp ......\target\classes;......\target\dependency com.emerald_associates.setupapp.xsd.AppStructureSchema

Where ......\target\classes is where my generated classes are, ......\target\dependency is where my dependencies are (I use maven and I prepare my target folder with a mvn clean compile dependencies:copy-dependencies), and the last argument is the class that is going to be source for the schema.

I quite don't answer your question, but you wouldn't be in much trouble using JAXB. It is free and it does the trick, unless you need the XSD in a specific format that only Castor can handle.

Upvotes: 1

Related Questions