JAXB:防止重新生成类 [英] JAXB: Prevent classes from being regenerated
问题描述
我在保持课堂重生方面遇到了麻烦。我是
我有一个模式A,它在模式B中导入。模式B然后在模式C中导入。
在模式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),一切都很好。
感谢您的帮助。
您可以使用剧集文件进行模块化模式编译:
I'm having troubles keeping classes from being regenerated. I'm
I have a schema A, which is imported in schema B. Schema B is then imported in Schema C.
In schema A, I have two simpleTypes, which are enumerations of strings:
<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>
Theses produces generated classes. In schema C, the classes corresponding to these enumerations keep being regenerated, and of course in the wrong place. I'm adding references to existing classes this way : (jaxb-creating-modules-for-reuse)
<jaxb:bindings node="//xs:simpleType[@name='blah_type']">
<jaxb:class ref="com.stuff.otherstuff.really.deep.BlahType"/>
</jaxb:bindings>
I have other types (complexTypes, and non enumeration simpleTypes) for which everything is fine.
Thanks for your help.
You can use episode files to do modular schema compilation:
- JAXB - Creating modules for reuse
- http://weblogs.java.net/blog/kohsuke/archive/2006/09/separate_compil.html?force=741
这篇关于JAXB:防止重新生成类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!