Hi, I just completed the test framework for my project. As I suggested earlier also, this is how it works.
I start with a schema file. Generate JAXB2 classes from it and compile it. Then use the code I wrote to generate the schema out of it. After that I use the same generated code to generate the schema using JAXB2 schema gen tool. Finally I compare the schema coming out of my tool against the schema that I get from schema gen tool using XMLUnit. All the JAXB2 related code are written using the ant taks that are provided. I am doing the same processfor ALL the schema files within test-resources folder. One observations was that I can not test the schema that I generate with the original schema. Reason is that JAXB2 loses some information during the code generation process. For example, choices will disappear. My task is to generate the same schema that JAXB2 schema generates so comparing it with it. I have bit of trouble using XMLUnit to compare two schemas. Some times it gives me an error eventhough two schemas are equal. The reason is that it is expecting same element order in both the files, it seems. This might not happen as the tools generate schema elements in the order they encounter java files. So can anyone of you suggest me a better way to compare two schemas or at least two xml files? Ralf once suggested to use Castor schema model to compare two schemas. But I couldn't find a way within the Schema class, like an overriden equals method or compare method. So if some one can give me a pointer it would be great. Thanks, SD