Posted by kohsuke
on April 6, 2006 at 9:40 AM PDT
Let me talk about a little technique to make your JAXB life little easier...
Often, the only JAXB customizations that you need to use are globalBindings and schemaBindings so that, for example, you can set a package, etc.
Now, specifying these cusotmiztions inline in schema is pretty straight-forward, but doing so externally (which you have to do if you don't want to change the schema) is more work. Normally, the way you specify these bindings externally is to write something like this:
In particular, it needs to refer to schema files you are compiling, so every time you use JAXB for different places, you need to tweak this file. That's where the idea of what I call "schemalet" comes in for a rescue.
The idea is that, since one can split definitions of one namespace into multiple schema files, instead of trying to attach a customization to an existing schema, you can just write a new "tiny" schema file that just has the customization, like this:
You can then save this file as "mycustomization.schemalet" (or any other name you like --- file extension doesn't matter), and then submit this to XJC along with your real schemas:
$ xjc ... a.xsd b.xsd c.xsd mycustomization.schemalet
Eventually the right thing to do is to expand the customization syntax, but for now, for some people, this might work handy.