title: Cannot resolve the name to a(n) 'element declaration' component
body: <p>while compiling maven-jaxb2-plugin I get below error</p>
  
  <pre><code>[INFO] --- maven-jaxb2-plugin:0.8.3:generate (default) @ customer-project ---
     [ERROR] Error while parsing schema(s).Location [ file:....Customer.xsd{12,97}].
      org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'ttadcustomer:CustomerApplicationDetail' to a(n) 'element declaration' component.
          at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
          at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
          at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
          at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(
  </code></pre>
  
  <p>A.xsd</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="windows-1252" ?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns="http://www.cohbe.org/CustomerRequest"
              xmlns:ttadcustomer="http://www.cohbe.org/customer"
              targetNamespace="http://www.cohbe.org/CustomerRequest"
              elementFormDefault="qualified"&gt;
      &lt;xsd:import schemaLocation="TTAdDETAILS.xsd"
                namespace="http://www.cohbe.org/customer"/&gt;
      &lt;xsd:element name="CustomerNewRequest"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element ref="ttadcustomer:CustomerApplicationDetail" minOccurs="0"/&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
      ...
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>Here is TTAdDETAILS.xsd</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsd:schema version="2.15" 
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns="http://www.cohbe.org/customer"
              targetNamespace="http://www.cohbe.org/customer"
              xmlns:countries="http://www.cohbe.org/Counties"
              elementFormDefault="qualified"&gt;
  
      &lt;xsd:complexType name="CustomerApplicationDetail"&gt;
  
      .....
      &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>If I use <strong>type</strong> instead of <strong>ref</strong> as suggested under  Heterogeneous Namespace Design  <a href="http://www.xfront.com/ZeroOneOrManyNamespaces.html" rel="nofollow">http://www.xfront.com/ZeroOneOrManyNamespaces.html</a></p>
  
  <p>I get below error</p>
  
  <pre><code>One of 'ref' or 'name' must be present in a local element declaration.
  </code></pre>