title: xml schema type is not declared or is missing
body: <p>I have been fighting this for the past day and read countless other posts here on SO that all give the same advice for my problem.  However, that advice is not working for me.  I am using the xsd files for the CDA format from HL7 to try and generate my classes (unfortunately the files are too large to post here).  Here are the relevant parts of the schema:</p>
  
  <pre><code>&lt;xs:schema targetNamespace="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns="urn:hl7-org:v3" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;
  
      &lt;xs:element name="POCD_MT000040.ClinicalDocument" type="ClinicalDocument"/&gt; &lt;!-- error message points to the "&lt;xs:element" on this line --&gt;
  &lt;xs:complexType name="POCD_MT000040.ClinicalDocument"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="realmCode" type="CS" minOccurs="0" maxOccurs="unbounded"/&gt;
          &lt;xs:element name="typeId" type="POCD_MT000040.InfrastructureRoot.typeId"/&gt;
          &lt;xs:element name="templateId" type="II" minOccurs="0" maxOccurs="unbounded"/&gt;
          &lt;xs:element name="id" type="II"/&gt;
          &lt;xs:element name="code" type="CE"/&gt;
          &lt;!-- many more elements follow --&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I have found dozens of postings here on SO from people reporting similar messages.  All of them say the problem is either that a default Namespace is missing or the complexType needs an accompanying "xs:element" declaration.  As you can see I have both.  So why is this happening?</p>
  
  <p>I should add I have tried using XmlSpy to generate the classes from the xsd with it reporting the same error.  However, my specific tools are from .NET.  I have received the same error from Visual Studio, xsd.exe, and xml2code.</p>
  
  <p>Any thoughts or ideas would be greatly appreciated!</p>