Reputation: 201
I generate XML schema (XSD) from Java classes with JAXB. I wonder how to specify the value of a static attribute by using annotations.
For example I define an attribute like this
@XmlAttribute(name="tooltip")
private static final String TOOLTIP = "A string";
And I want to get in my XSD
<attribute name="tooltip" type="string" fixed="A string">
So, how can I force the generation of static attributes in XSD with JAXB?
Thanks !
Upvotes: 3
Views: 1189
Reputation: 148977
As of JAXB 2.2, there isn't standard JAXB (JSR-222) metadata that can add to your model to cause the fixed
attribute to appear in the generated XML Schema. The schema generation errs on the side of being too permissive rather than too restrictive. This means you can't do the following:
Upvotes: 2