Jaxb does not generate base integer enumerations

I have xsd:

<xs:simpleType name="resultcode">
    <xs:restriction base="xs:integer">
        <xs:enumeration value="0" id="Approved_no_error">
            <xs:annotation>
                <xs:appinfo>
                    <jxb:typesafeEnumMember name="Approved_no_error"/>
                </xs:appinfo>
            </xs:annotation>
        </xs:enumeration>

JAX-B just does nothing, no errors, no warnings, this class simply does not generate. If the change base is from xs:integerto xs:string, then this is normal. But I need exactly integer values.

I generate classes with maven:

<groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>1.3</version>
    <executions>
        <execution>
            <id>AuthGateway</id>
            <goals>
                <goal>xjc</goal>
            </goals>

And question 2. JAX-B and IDE (IDEA) do not allow spaces in id attrribute attribute. Why?

<xs:enumeration value="0" id="Approved_no_error">- ok
<xs:enumeration value="0" id="Approved no error">- not normal

Is this behavior right?

+5
source share
1 answer

You can use an external binding file to get the behavior you are looking for:

+6

All Articles