Augusto
Augusto

Reputation: 1336

JAXB XSD Already Defined type

I'm trying to to use xjc to generate my classes after my xsd and I've got stuck in this error: 'MyType' is already defined.

This MyType is a complexType that I have in 2 different XSD's. In my search on google, everyone said to make a bindind in a xjb file to correct this. I've tried but it keeps failing. Here's the xjb:

   <jaxb:bindings schemaLocation="myfile.xsd" node="/xs:schema">
    <jaxb:bindings node="//xs:complexType[@name='MyType']">
      <jaxb:class name="MyType2" />
    </jaxb:bindings>
   </jaxb:bindings>

I've tried using this for both types in both xsd's and still not working. I have no idea what I can do to fix this. Thanks for helping.

Upvotes: 3

Views: 5115

Answers (1)

user177800
user177800

Reputation:

I had this same problem a while ago, the only solution that I could find out is was to process the files separately or modify one of the .xsd files and rename the duplicate to something else.

Upvotes: 1

Related Questions