JAXB:防止重新生成类

时间:2011-07-27 08:55:18

标签: xsd jaxb

我在保持课堂重生方面遇到了麻烦。我是

我有一个模式A,它在模式B中导入。然后在模式C中导入模式B.

在模式A中,我有两个simpleTypes,它们是字符串的枚举:

<xs:simpleType name="blah_type">
<xs:restriction base="xs:string">
        <xs:enumeration value="blah_1"/>
        <xs:enumeration value="blah_2"/>
        <xs:enumeration value="blah_3"/>
        <xs:enumeration value="blah_4"/>
        <xs:enumeration value="blah_5"/>
    </xs:restriction>
</xs:simpleType>


<xs:simpleType name="another_blah_type">
    <xs:restriction base="xs:string">
        <xs:enumeration value="another_blah_1"/>
        <xs:enumeration value="another_blah_2"/>
        <xs:enumeration value="another_blah_3"/>
        <xs:enumeration value="another_blah_4"/>
        <xs:enumeration value="another_blah_5"/>
    </xs:restriction>
</xs:simpleType>

论文产生生成的类。在模式C中,与这些枚举对应的类不断重新生成,当然也在错误的位置。我正在以这种方式添加对现有类的引用:(jaxb-creating-modules-for-reuse

<jaxb:bindings  node="//xs:simpleType[@name='blah_type']">
    <jaxb:class ref="com.stuff.otherstuff.really.deep.BlahType"/>
</jaxb:bindings>

我有其他类型(complexTypes和非枚举simpleTypes),一切都很好。

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

相关问题