title: XSD with imports and namespaces
body: <p>Hi I am trying to get my mind around XSDs, XML and namespaces but I can't get things to work the way I want them to.</p>
  
  <p>I have an XSD which, at the moment, starts like this:</p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" 
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             xmlns="http://www.example.com"&gt;
      &lt;xs:import namespace="http://www.example.com" schemaLocation="Include.xsd" /&gt;
  </code></pre>
  
  <p>As you can see, it imports another xsd file, which starts like this:</p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" 
             targetNamespace="http://www.example.com" 
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             xmlns="http://www.example.com"&gt;
  </code></pre>
  
  <p>Then I have some xml documents based on this schema:</p>
  
  <pre><code>&lt;foobar&gt;
      &lt;whatever&gt;....
  </code></pre>
  
  <p>Basically I don't care what the namespaces are, I just want the darn thing to work. Previously I wasn't using any namespace but it seems that I have to use them in order to import one XSD into another. What I don't want to do is have to supply prefixes to all the elements in my xml documents.</p>
  
  <p>In order to achieve this, what combination of values do I need for the various attributes (<em>targetNamespace, namespace, xmlns, elementFormDefault</em> etc) in the XSD and XML documents?</p>
  
  <p>Currently, any elements defined in the imported XSD document require namespace qualification in the XML.</p>