I have a large third-party xsd file that captures a whole bunch of other xsd files through import. All this creates more than 1000 classes. When I tell the xjc (jaxb) processor to generate everything in a specific package, I get all kinds of naming conflicts. If I do not specify a package, then the processor creates java packages using the target attributes in the xsd files, and all this is generated without any errors.
The problem is that the package structure is terrible because the target names are chosen very poorly. Other developers hate this. They only need a few classes.
So, what I was trying to do was provide the processor with a bindings.xml file where I want to specify specific classes that will be generated in the given package name. I went back and forth between the documentation on the Oracle website, forums, and samples. I cannot quote every iteration of my bindings file. My current incarnation is this:
<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.1" schemaLocation="heavy.xsd" node="//xsd:element[@name='Error']" > <jaxb:bindings node="//xsd:element[@name='Error']"> <jaxb:package name="ABC"/> </jaxb:bindings> <jaxb:globalBindings underscoreBinding="asCharInWord" localScoping="toplevel" typesafeEnumMaxMembers="10000" generateElementClass="true" > </jaxb:globalBindings> </jaxb:bindings>
No matter what I try, I have not yet seen it generate any classes in the ABC package. In this case, I want the Error to occur in ABC. Any help would be greatly appreciated.
source share