jaxb doesn#39;t generate enums with base integer(jaxb 不生成具有基本整数的枚举)
问题描述
我有以下 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 就可以了.但我需要的正是整数值.
JAX-B just does nothing, no errors, no warnings just doesn't generate this class. If change base from xs:integer to xs:string then it's ok. But I need exactly integer values.
我用 maven 生成类:
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>
问题 2.JAX-B 和 IDE (IDEA) 不允许在 id 属性中使用空格.为什么?
And question 2. JAX-B and IDE (IDEA) doesn't allow whitespaces in id attrribute. Why?
<xs:enumeration value="0" id="Approved_no_error"> - 好的<xs:enumeration value="0" id="Approved no error"> - 不行
这是正确的行为吗?
推荐答案
您可以使用外部绑定文件来获取您正在寻找的行为:
You can use an external binding file to get the behaviour that you are looking for:
- 带数值的JAXB枚举
- http://blog.bdoughan.com/2011/08/jaxb-and-enums.html
这篇关于jaxb 不生成具有基本整数的枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:jaxb 不生成具有基本整数的枚举
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
