0

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.

Community
  • 1
  • 1
Cheese Daneish
  • 1,030
  • 7
  • 15

1 Answers1

1

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
  • 10,416
  • 2
  • 25
  • 34
  • Maybe I can explain it a little better. 1) XSD was created and checked in to source control 2) XSD was modified, and not checked in 3) Castor binding objects were created based on the modified XSD that was not checked in 4) Updated XSD was deleted, lost, whatever. We don't have it any more 5) 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. – Cheese Daneish Feb 26 '10 at 15:18
  • If it is possible with Castor from those objects, I would not know :-(. – Ravi Wallau Feb 27 '10 at 19:01