I have created a new JAXB project and imported an xsd which I am trying to generate JAXB classes off of. When I select "Generate->JAXB Classes" I get a number of similar errors all which relate to naming conflicts:
A class/interface with the same name "generated.Document" is already in use. Use a class customization to resolve this conflict.
The above error is thrown from the following piece of the .xsd file
<xs:complexType name="Document">
<xs:sequence>
<xs:element ref="Document"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Document">
...
Changing the .xsd file is not an option for me so I have to find another way. I have been reading about the possibility of creating a bindings file. I can't seem to find good documentation on how to do that for my particular problem. My three main questions are:
yes, you can with an xjb file
(e.g. I don't know your entire xsd, this is only an example)
<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:annox="http://annox.dev.java.net">
<bindings node="xs:complexType[@name='Document']">
<class name="Item"/>
</bindings>
</bindings>
Eclipse allows you to attach an XJB file (Binding files:)
I hope I've given you all the answers about your question.