title: xjc error: "Two declarations cause a collision" on valid .xsd
body: <p>I've got a valid .xsd as API description. Here it is (w/o redundant code):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xsd:simpleType name="String"&gt;
          &lt;xsd:restriction base="xsd:string"/&gt;
      &lt;/xsd:simpleType&gt;
  
      &lt;xsd:complexType name="ErrorType"&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="Type"&gt;          
                  &lt;xsd:complexType&gt;
                        &lt;xsd:attribute name="Name" type="String" use="required"/&gt;
                  &lt;/xsd:complexType&gt;
              &lt;/xsd:element&gt;
          &lt;/xsd:sequence&gt;        
      &lt;/xsd:complexType&gt;
  
      &lt;xsd:complexType name="ErrorTypeType"&gt;
          &lt;xsd:attribute name="Code" type="String" use="required"/&gt;
          &lt;xsd:attribute name="Name" type="String" use="required"/&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>It is validated by <a href="http://www.validome.org/grammar/validate/" rel="nofollow">http://www.validome.org/grammar/validate/</a></p>
  
  <p>But <code>xjc MySchema.xsd</code> raises the following error:</p>
  
  <pre><code>parsing a schema...
  compiling a schema...
  [ERROR] Two declarations cause a collision in the ObjectFactory class.
    line 17 of file:/C:/Users/dev05/Downloads/MySchema.xsd
  
  [ERROR] (Related to above error) This is the other declaration.
    line 10 of file:/C:/Users/dev05/Downloads/MySchema.xsd
  
  Failed to produce code.
  </code></pre>
  
  <p>Should I ask API creators to change it (that is quite hard) or there are some workarounds to overcome this issue?</p>