Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

xsd - JAXB: Prevent classes from being regenerated

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...