title: XML validation: is it necessary to bind the elements to a namespace?
body: <p>I'm trying to validate a client XML using a Schema they have sent. Schematically it looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
             xmlns="http://www.client.com"
             targetNamespace="http://www.client.com"
             elementFormDefault="qualified"
             attributeFormDefault="unqualified"
             version="0.1"&gt;
  
  &lt;xs:element name="root"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element ref="Parent" minOccurs="0" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  
  &lt;xs:element name="Parent"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="Child1" type="xs:string"/&gt;
        &lt;xs:element name="Child2" type="xs:string" nillable="true"/&gt;
        &lt;xs:element name="Child3" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>An example of the XML I'd like to validate would be</p>
  
  <pre><code>&lt;Parent&gt;
    &lt;Child1&gt;Entry&lt;/Child1&gt;
    &lt;Child2 xsi:nil="true"/&gt;
    &lt;Child3&gt;Entry&lt;/Child3&gt;
  &lt;/Parent&gt;
  </code></pre>
  
  <p>My question is this: is the XML above actually well-formed? My (poor) understanding of XML makes me think that a namespace is required for the 'xsi' tag, and indeed when we validate this is the error we get (The tag 'xsi' is not bound to any namespace). Changing the XML to look like:</p>
  
  <pre><code>&lt;Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;Child1&gt;Entry&lt;/Child1&gt;
    &lt;Child2 xsi:nil="true"/&gt;
    &lt;Child3&gt;Entry&lt;/Child3&gt;
  &lt;/Parent&gt;
  </code></pre>
  
  <p>fixes problems on our end and makes more sense to me. However the client have said the original XML validates in XMLSpy and VisualStudio so maybe I'm missing something?</p>
  
  <p>Any help would be greatly appreciated. Thanks very much!</p>