7

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.

Community
  • 1
  • 1
ins
  • 73
  • 1
  • 3

1 Answers1

3

You can use episode files to do modular schema compilation:

Community
  • 1
  • 1
bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • 1
    I'm trying to find a workaround for what I need. I just wanted to precise that the java enumerations are not in the .episode file, and are still regenerated. I noticed that the problem occurs only for these enums.. – ins Jul 27 '11 at 12:25
  • I know, that this post ist very old, but I can't find a solution to preserve the generation of enums. Have you found something? – D051P0 Aug 08 '16 at 08:05
  • My question was answered now - [Here](http://stackoverflow.com/questions/38824179/jaxb-class-ref-prevent-enum-generation/) is the way, how it schoud work. – D051P0 Aug 08 '16 at 10:03