本文介紹了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 不生成具有基本整數的枚舉的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!