title: XSD: default value of a missing element
body: <p>Is it possible to define a default value for a missing element in an XML Schema. I have the following snippet:</p>
  
  <pre><code>&lt;xs:element name="protocol" nillable="false" minOccurs="0" default="ftp"&gt;
    &lt;xs:simpleType&gt;
      &lt;xs:restriction base="xs:string"&gt;
        &lt;xs:enumeration value="ftp"/&gt;
        &lt;xs:enumeration value="webdav"/&gt;
      &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>If I have in the XML file</p>
  
  <pre><code>&lt;protocol&gt;ftp&lt;/protocol&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;protocol&gt;webdav&lt;/protocol&gt;
  </code></pre>
  
  <p>it validates and I obtain the right value.
  If I have in the XML file</p>
  
  <pre><code>&lt;protocol&gt;&lt;/protocol&gt;
  </code></pre>
  
  <p>it also validates and I obtain the default value of ftp.</p>
  
  <p>My searches show that default attribute values apply when attributes are missing, and default element values apply when elements are empty. Is it possible to have a default value for a missing element?</p>
  
  <p>Regards</p>
  
  <p>rambius</p>