title: What's wrong with my XSD XML Schema?
body: <p>I'd been 3 years since I messed with schemas and I remember them being very particular about name space prefixes and all. I also remember complex types not parsing so easily without unrolling when using the XML editor in Eclipse (I have Indigo).</p>
  
  <p>So could one is you XML gurus look at my XML file and tell me what is wrong with the prepended XSD XML schema?</p>
  
  <p>Thanks.</p>
  
  <p>Ciao</p>
  
  <p>+++++</p>
  
  <p>Eclipse complains of:</p>
  
  <p>The markup in the document following the root element must be well-formed.</p>
  
  <p>I should point out I created the XML by hand and autogenerated the XML from it at:</p>
  
  <p><a href="http://www.xmlforasp.net/codebank/system_xml_schema/buildschema/buildxmlschema.aspx" rel="nofollow">http://www.xmlforasp.net/codebank/system_xml_schema/buildschema/buildxmlschema.aspx</a></p>
  
  <p>(Seperate Complex Types: as I did manually 3 years ago with Amazon's Amazon Seller Central XML files manually)</p>
  
  <p>If seems to me as ref should be used in one case but I'll defer to the experts.</p>
  
  <p>+++++</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  
  &lt;xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xsd:element name="idioms" type="idiomsType" /&gt;
      &lt;xsd:complexType name="idiomsType"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element maxOccurs="unbounded" name="idiom" type="idiomType" /&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
      &lt;xsd:complexType name="idiomType"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="phrase" type="xsd:string" /&gt;
              &lt;xsd:element name="meaning" type="xsd:string" /&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  &lt;/xsd:schema&gt;
  
  &lt;idioms&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A bit much&lt;/phrase&gt;
          &lt;meaning&gt;Excessive or annoying.&lt;/meaning&gt;
      &lt;/idiom&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A bridge too far&lt;/phrase&gt;
          &lt;meaning&gt;Act of overreaching.&lt;/meaning&gt;
      &lt;/idiom&gt;
  &lt;/idioms&gt;
  </code></pre>
  
  <p>OK, update. My shortcut of including XSD inline with XML is illegal. So I put it back in XSD file. I also learned that I can't start a prefix with xml so I changed it to 'tc'.</p>
  
  <p>The XSD now is correct (in the same style as I unrolled Amazon Seller Central XSDs).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  
  &lt;xsd:schema xmlns:tcidioms="urn:tcidioms" targetNamespace="urn:tcidioms" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
       &lt;xsd:element name="idioms" type="tcidioms:idiomsType"/&gt;
       &lt;xsd:complexType name="idiomsType"&gt;
           &lt;xsd:sequence&gt;
               &lt;xsd:element maxOccurs="unbounded" name="idiom" type="tcidioms:idiomType" /&gt;
           &lt;/xsd:sequence&gt;
       &lt;/xsd:complexType&gt;
       &lt;xsd:complexType name="idiomType"&gt;
           &lt;xsd:sequence&gt;
               &lt;xsd:element name="phrase" type="xsd:string" /&gt;
               &lt;xsd:element name="meaning" type="xsd:string" /&gt;
           &lt;/xsd:sequence&gt;
       &lt;/xsd:complexType&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>But I have trouble trying to include this im my XML file which now looks like this (the XML &amp; XSD are in the same directory):</p>
  
  <p>It complains:  No grammar constraints (DTD or XML schema) detected for the document.</p>
  
  <p>Meaning the 2 line in my XML document isn't correct. I've tried several variants to include this file but none have worked. Keep in mine this XML (and XSD) is going to be read off a local file systems rather than via http. Will it still validate in this manner?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  
  &lt;idioms xmlns:tcidioms="urn:tcidioms" targetNamespace="urn:tcidioms ./EnglishIdioms.xsd"&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A bit much&lt;/phrase&gt;
         &lt;meaning&gt;Excessive or annoying.
         &lt;/meaning&gt;
      &lt;/idiom&gt;
      &lt;idiom&gt;
           &lt;phrase&gt;A bridge too far&lt;/phrase&gt;
     &lt;meaning&gt;Act of overreaching, going too far
          and getting into trouble
          or
          failing.
     &lt;/meaning&gt;
      &lt;/idiom&gt;
  &lt;/idioms&gt;
  </code></pre>
  
  <p>Visual Studio 2010 (it created the schema Russian Doll Style):</p>
  
  <p>The XML file although set to use the schema in the VS2010 interface doesn't show that in the code?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xs:element name="idioms"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element maxOccurs="unbounded" name="idiom"&gt;
                      &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element name="phrase" type="xs:string" /&gt;
                              &lt;xs:element name="meaning" type="xs:string" /&gt;
                          &lt;/xs:sequence&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;idioms&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A bit much&lt;/phrase&gt;
          &lt;meaning&gt;Excessive or annoying.&lt;/meaning&gt;
      &lt;/idiom&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A bridge too far&lt;/phrase&gt;
          &lt;meaning&gt;Act of overreaching.&lt;/meaning&gt;
      &lt;/idiom&gt;
      &lt;idiom&gt;
          &lt;phrase&gt;A chain is no stronger than its weakest link&lt;/phrase&gt;
          &lt;meaning&gt;The weakest part of an object is it's strength.&lt;/meaning&gt;
      &lt;/idiom&gt;
  &lt;/idioms&gt;
  </code></pre>