title: Validation of XML with maven-created schema fails when namespace is defined
body: <p>Validation of XML with maven-created schema fails when namespace is defined, but
  validating against the schema works as long as I don't configure the namespace.</p>
  
  <pre><code>&lt;transformSchemas&gt;
  &lt;!--  doesn't work
      &lt;transformSchema&gt;
          &lt;uri&gt;tlm-classification&lt;/uri&gt;
          &lt;toPrefix&gt;tlm-ec&lt;/toPrefix&gt;
          &lt;toFile&gt;classification.xsd&lt;/toFile&gt;
      &lt;/transformSchema&gt;
  --&gt;
  &lt;/transformSchemas&gt;
  </code></pre>
  
  <p>If I define the namespaces, add a uri and also add the namespace to all the jaxb-annotated java classes there are two XSD files created instead of one and also the validation fails with:</p>
  
  <pre><code>src-resolve: Cannot resolve the name 'equipmentClassification' to a(n) 'type definition' component.
  </code></pre>
  
  <p>After I copied both xsd files into the classpath, I got</p>
  
  <pre><code>cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"tlm-equipmentclassification":count}' is expected.
  </code></pre>
  
  <hr>
  
  <p>While creating the namespace-XSDs with maven I get this warning, that I couldn't fix,
  maybe the errors are related to that.</p>
  
  <pre><code>[INFO] --- jaxb2-maven-plugin:1.5:schemagen (default-cli) @ tlmsim ---
  Note: Writing C:\dev\java\workspaces\tlm\tlmsim\schema1.xsd
  Note: Writing C:\dev\java\workspaces\tlm\tlmsim\schema2.xsd
  [WARNING] SimpleNamespaceResolver contained no localNamespaceURI; aborting rename.
  </code></pre>
  
  <p>I can also provide the xml, and the xsd files. But as the XMLs and the single non-namespace XSD validate, the errors must lie somewhere in the JAXB annotations.</p>
  
  <p><strong>Question</strong></p>
  
  <ul>
  <li>Why are there two XSD files created when I define a namespace?</li>
  <li>What do I have to consider annotating the JAXB-annotated classes.</li>
  <li>(Since it is suggested to use <code>javac</code> because <code>schemagen</code> will not
  be supported in future. Do you have any input on that?)</li>
  </ul>
  
  <p><strong>Additional info</strong></p>
  
  <p>I'm using <code>org.codehaus.mojo:jaxb2-maven-plugin</code> in version <code>1.5</code>.</p>
  
  <p>I have some kind of class hierarchy, and even use XmlAdapter to marshall a map thats contained in some of the <code>XmlRootelement</code>s. Some parentclasses share the same child elements. My original plan was to automatically create a standalone scheme for each <code>XmlRootelement</code> in its corresponding directory.</p>
  
  <p>If more information is needed, I can provide it.</p>