繁体   English   中英

jaxb不会使用基本整数生成枚举

[英]jaxb doesn't generate enums with base integer

我有以下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只是不执行任何操作,没有错误,没有警告也不会生成此类。 如果将xs:integer基数更改为xs:string则可以。 但是我需要正整数值。

我用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>

问题2。JAX-B和IDE(IDEA)不允许在id属性中使用空格。 为什么?

<xs:enumeration value="0" id="Approved_no_error"> -好的
<xs:enumeration value="0" id="Approved no error"> -不正常

这是正确的行为吗?

您可以使用外部绑定文件来获取所需的行为:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM