1

I am building a program that uses XML for defining a configuration.

Currently, I am in the early phases, and I have built the first XSD Schema. The second Schema has numerous common types that are defined in the first Schema, and so instead of copying the types, I have decided to import the first Schema into the second one. This is to allow for modifications to the first Schema to be propagated to the second.

As far as XML validation goes, this all works fine, but when I get JAXB to generate the classes from the Schema, it creates two copies of the imported Schema types.

Note: I am currently using 2 JAXB (Maven) executions together (with clearOutputDir on the second configuration) to generate the classes into separate packages (one for each Schema)

Is there a way to configure JAXB to reference the imported types in the second Schema to the generated classes for the first rather than recreating the same classes?

Additional: Although I can copy the generated classes into my sources and make the modifications there, I would prefer not to do so as that such a process would require the modifications to be made each time the schema had any modification

topherg
  • 4,203
  • 4
  • 37
  • 72

0 Answers0