Skip to main content

JAXB: W3C spec XSD -> 2 different packages

1 reply [Last post]
Joined: 2004-07-10
Points: 0

Hi JAXB gurus - I have an interesting challenge I hope someone can help out with.

I want to have xjc generate Java classes from the W3C specification for XML Encryption. That .xsd is located here:

Note that this .xsd additionally imports the W3C XML Digital Signature .xsd.

When I run xjc without any customization, it creates two packages based on the namespaces alone:


Which is great - just not what I want. I want to customize this so that the objects go in org.w3.xmlenc and org.w3.xmldsig packages respectively.

Also, because this is a W3C spec, I don't want to/can't touch the source .xsd files at all. I need to treat them as static/read-only. I'm putting my JAXB directives in a separate .xjb file.

How do I make this happen based on external .xjb customization files without touching the source .xsd files?

Thanks for any pointers!



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-09-23
Points: 0

You defenitely need to read this part of JAX-WS tutorial:

For you customization file should look like this:
xmlns:xsi="" xmlns:xjc=""
jxb:extensionBindingPrefixes="xjc" xmlns:jxb=""

generateIsSetMethod="true" fixedAttributeAsConstantProperty="true" />



I haven't tested it but you should get the idea.