Need help with following situation: Users can generate their own data structures which are stored as JAXB-ready XSD sources like below:
I do not believe that there is an easy way to do this using JAXB itself. There are a number of customization options available that are not commonly known - read section 7 of JSR222 for details.
If you have some control over the input schemas, then you might want to consider using XSLT to transform the schema. I believe that this can be done by using a javax.xml.transform.dom.DOMResult
instance as the target of the transformation and using the output as a DOM tree (e.g., calling getNode()
on the result) as the input to parseSchema
. A basic transformation would be to replace:
with something like:
Of course this only works for the simple cases. If you already have inheritance in your schema files, then you will have to do some filtering in the XSLT that only applies this transform to types that do not already extend.