title: JAXB workaround for Chameleon XSD imports?
body: <p>this is my first question, so please be gentle ;)</p>
  
  <p>I'm stuck with a weird problem. Essentially i get three XSD definitions like the following:</p>
  
  <pre><code>PartA.xsd
  targetNameSpace="PartA"
  include="PartB.xsd"
  
  PartB.xsd
  &lt;!-- no namespace definition!!! --&gt;
  
  PartC.xsd
  targetNameSpace="PartC"
  inlude="PartB.xsd"
  import="PartA.xsd"
  </code></pre>
  
  <p>The error pops up, when binding <em>PartC</em> via JAXB to Java classes:</p>
  
  <ul>
  <li>A class/interface with the same name "b.exampleType" is already in use. Use a class customization to resolve this conflict.</li>
  <li>This confusing error happened most likely because the schema uses a technique called "chameleon schema", which causes a single definition to be loaded multiple times into different namespaces. See <a href="http://forums.java.net/jive/thread.jspa?threadID=18631" rel="noreferrer">http://forums.java.net/jive/thread.jspa?threadID=18631</a> for more about this.</li>
  </ul>
  
  <p>Following the link, i found out, the actual error lies in PartB, which has no namespace declaration! This method is called <strong><em>Chameleon Schema</em></strong>. The defined types in <em>PartB</em> will adopt the namesspace of the <em>importing XSD</em>.</p>
  
  <p>So in my case, there are two namespaces for the same type:</p>
  
  <ol>
  <li>"PartA"</li>
  <li>"PartC"</li>
  </ol>
  
  <p>And this is, where JAXB breaks down. I haven't found a way to bind <em>PartC</em> properly. And (to make things tricky) i have chance to change the original XSD definitions!</p>
  
  <p>Has anyone come across this phenomena or something like that before and has a valid workaround for it? </p>