title: Xsd validation problem
body: <p>I have the following (errorous) Xml:</p>
  
  <pre><code>&lt;jobs&gt;
      &lt;job&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;state&gt;&lt;![CDATA[IL]]&gt;&lt;/state&gt;
      &lt;/job&gt;
      &lt;job&gt;
          &lt;id&gt;2&lt;/id&gt;
      &lt;/job&gt;
  &lt;/jobs&gt;
  </code></pre>
  
  <p>both the id and the state node are reqired items. I wrote an Xsd for it:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema id="importvalidator"
      elementFormDefault="qualified"
      targetNamespace="http://foo.org/importvalidator.xsd"
      xmlns="http://foo.org/importvalidator.xsd"
      xmlns:mstns="http://foo.org/importvalidator.xsd"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xs:element name="jobs"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name="job" minOccurs="1" maxOccurs="unbounded"&gt;
                &lt;xs:complexType&gt;
                  &lt;xs:all&gt;
                    &lt;xs:element name="id" type="xs:string" minOccurs="1"/&gt;
                    &lt;xs:element name="state" type="xs:string" minOccurs="1"/&gt;
                  &lt;/xs:all&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;
  </code></pre>
  
  <p>
  </p>
  
  <p>And it still validates as a structurally valid Xml. What am I missing here?</p>
  
  <p>Update1: the code I'm using is in C#:</p>
  
  <pre><code>        XmlSchemaSet schemas = new XmlSchemaSet();
          schemas.Add("http://foo.org/importvalidator.xsd", "validator.xsd");
  
          XDocument doc = XDocument.Load(fileName);
          if (doc == null | doc.Root == null)
          {
              throw new ApplicationException("xml error: the referenced stream is not xml.");
          }
  
          doc.Validate(schemas, (o, e) =&gt;
          {
              throw new ApplicationException("xsd validation error: xml file has structural problems");
          });
  </code></pre>