views:

53

answers:

1

http://stackoverflow.com/questions/607141/what-is-jaxb-and-why-would-i-use-it/607248#607248

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.

+1  A: 

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.

Ravi Wallau
Maybe I can explain it a little better.1) XSD was created and checked in to source control2) XSD was modified, and not checked in3) Castor binding objects were created based on the modified XSD that was not checked in4) Updated XSD was deleted, lost, whatever. We don't have it any more5) We have the castor binding objects but no XSD.Curious if there is a way to recreate the XSD from the Castor binding objects. I haven't found anything on the website, but you would think if you can go one way, you could go back.
Mongo
If it is possible with Castor from those objects, I would not know :-(.
Ravi Wallau