title: How to use a namespace defined type from one XSD in another? (referencing it by namespace)
body: <p>DISCLAIMER: I am not too well versed in XSD, and may be expressing myself incorrectly.</p>
  
  <p>I have an XML file I need to validate and handle. I can change the XSDs but not the XML.</p>
  
  <p>The XML file is of type a.xsd, and a.xsd includes a type from b.xsd. This type is called in the XML referring the namespace, like so:</p>
  
  <pre><code>&lt;StuffDtl&gt;
  &lt;elem1&gt;test string&lt;/elem1&gt;
  &lt;elem2&gt;9&lt;/elem2&gt;
  &lt;supertype:uuuh_special&gt;test string&lt;/supertype:uuuh_special&gt;
  &lt;/StuffDtl&gt;
  </code></pre>
  
  <p>The XSDs are defined like below:</p>
  
  <p>a.xsd</p>
  
  <pre><code>&lt;!-- language: lang-xml --&gt;
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema  elementFormDefault="qualified"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:supertype="http://www.b.com"&gt;
  &lt;xs:import  namespace="http://www.b.com"
  schemaLocation="b.xsd" /&gt;
  &lt;xs:element name="StuffDtl"&gt;
  &lt;xs:complexType&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="elem1"         type="xs:decimal" /&gt;
  &lt;xs:element name="elem2"         type="xs:int" /&gt;
  &lt;xs:element name="uuuh_special"  type="supertype:SuperType" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>b.xsd</p>
  
  <pre><code>&lt;!-- language: lang-xml --&gt;
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.b.com"
  elementFormDefault="qualified"&gt;
  &lt;xs:complexType name="SuperType"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:choice&gt;
  &lt;xs:group ref="one_thing" /&gt;
  &lt;xs:group ref="another_thing" /&gt;
  &lt;/xs:choice&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:group name="one_thing"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="year" type="xs:decimal" /&gt;
  &lt;xs:sequence minOccurs="0"&gt;
  &lt;xs:element name="hour" type="xs:decimal" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:group&gt;
  &lt;xs:group name="another_thing"&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="date-value" type="xs:string" /&gt;
  &lt;xs:element name="date-format" type="xs:string" minOccurs="0" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:group&gt;
  &lt;/xs:schema&gt;
  </code></pre>