I want to restrict input values like this
<simpleType name="SomeCode">
<restriction base="string">
<enumeration value="036222B"/>
<enumeration value="036111C"/>
</restriction>
</simpleType>
But this does not generate an Enum. I suspect it is because the values start with numbers and this is not allowed for Enum values.
Is there any solution or workaround?
Here is my answer to a similar question that may help (see issue 2):
There are a couple of enumeration values that are causing this issue. These issues can be overcome through the use of a JAXB external binding file (see below).
Enum Issue #1 – Empty String
Some of your enum values are empty string (“”), which is causing a String rather than an enum property to be generated:
Enum Issue #2 – Numeric String
Some of the enum values are numbers which is causing a String rather than an enum property to be generated:
Bindings File (bindings.xml)
The following bindings file can be used to address the issues with the educationLevelType, the concepts here can be applied to all the problematic types:
The XJC call can be made as follows (the -nv flag is described below):
This will cause the following Enum to be generated:
maxOccurs Issue
For the maxOccurs issue, the following command line with the no verify (-nv) flag can be used to parse the XML schema:
This will get you past the following error without having to modify the XML schema:
For More Information