2011-12-20 39 views
5

枚举我有以下的xsd:JAXB不会产生与基地整数

<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 attrribute空格。为什么?

<xs:enumeration value="0" id="Approved_no_error"> - 确定
<xs:enumeration value="0" id="Approved no error"> - 也不行

它是正确的行为?

回答