title: compiler was unable to honor this ci:code customization. It is attached to a wrong place, or its inconsistent with other bindings
body: <p>using jaxb xjc to generate java classes from schema, I'm trying to customize the binding to inject java code into the generated java classes.</p>
  
  <p>The schema I use is a standard schema, but for each element in this schema I want to add a java variable to the generated java that does not exist in schema. for example:
  the schema has element:</p>
  
  <pre><code>&lt;xs:element name="long-desc"&gt;
    &lt;xs:complexType mixed="true"&gt;
      &lt;xs:attribute name="id" type="xs:ID"/&gt;
      &lt;xs:attribute name="content-type"/&gt;
      &lt;xs:attribute name="specific-use"/&gt;
      &lt;xs:attribute ref="xml:lang"/&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>For the generated java class, I want to inject java code like:</p>
  
  <pre><code>@XmlAttribute(name = "sem-uri")
  @XmlSchemaType(name = "anyURI")
  protected String semUri;
  </code></pre>
  
  <p>so I created a binding file like the following: </p>
  
  <pre><code>&lt;jxb:bindings multiple="true" node="//xs:element/xs:complexType[not(@mixed='true')]"&gt;
      &lt;ci:code&gt;
      @XmlAttribute(name = "sem-uri")
      @XmlSchemaType(name = "anyURI")
      protected String semUri;
      &lt;/ci:code&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>but when I run xjc using <code>xjc -Xinject-code -extension simpleBinding.schemalet  ISOSTS.xsd -b binding.xjb -d C:\outputcode</code>, I get the error:</p>
  
  <pre><code>[ERROR] compiler was unable to honor this ci:code customization. It is attached to a wrong place, or its inconsistent with other bindings.
  line 25 of file:/C:/helen/working/ISOSTS/dtd/testing/inject-code-2/binding.xjb
  
  [ERROR] (the above customization is attached to the following location in the schema)
  line 856 of file:/C:/helen/working/ISOSTS/dtd/testing/inject-code-2/ISOSTS.xsd
  </code></pre>
  
  <p>I found I only get this error when the element in schema has attribute <code>mixed=true</code> for child element <code>xs:compleType</code>: <code>xs:complexType mixed="true"</code></p>
  
  <p>People with similar errors have had naming collisions which I verified it is not.</p>
  
  <p>Can anyone help me?</p>
  
  <p>Thanks in advance, Helen</p>
  
  <hr>
  
  <p>Edit: 12 January:</p>
  
  <p>I did a test for making all java classes that are generated by jaxb to extend a common java class, so now the generated java class looks like</p>
  
  <pre><code>public class Num
      extends SpecificationDocumentElement
      implements Serializable 
      {...
      }
  </code></pre>
  
  <p>and my common base class is as following</p>
  
  <pre><code>public class SpecificationDocumentElement 
  {
      @XmlAttribute(name = "sem-uri")
      @XmlSchemaType(name = "anyURI")
      protected String semUri;
  
      public String getSemUri() {
          return semUri;
      }
  
      public void setSemUri(String value) {
          this.semUri = value;
      }
  }
  </code></pre>
  
  <p>I need to use these jaxb generated java classes to do marshall/unmarshall for xml files. When I tried unmarshall from an xml file to java object, I got following errors:</p>
  
  <pre><code>javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 66 counts of IllegalAnnotationExceptions
  @XmlValue is not allowed on a class that derives another class.
  this problem is related to the following location:
      at protected java.lang.String com.xsb.isosts.isosts.Num.content
      at com.xsb.isosts.isosts.Num
      at protected java.util.List com.xsb.isosts.isosts.ChemStruct.content
      at com.xsb.isosts.isosts.ChemStruct
      at protected java.util.List com.xsb.isosts.isosts.Title.content
      at com.xsb.isosts.isosts.Title
      at protected java.util.List com.xsb.isosts.isosts.Std.content
      at com.xsb.isosts.isosts.Std
      at protected java.util.List com.xsb.isosts.isosts.RelatedArticle.content
      at com.xsb.isosts.isosts.RelatedArticle
      at public com.xsb.isosts.isosts.RelatedArticle com.xsb.isosts.isosts.ObjectFactory.createRelatedArticle()
      at com.xsb.isosts.isosts.ObjectFactory
      .....
  </code></pre>