title: How to get the default value from an XmlSchema
body: <p>I'm working with an XmlSchema object which was initialized with an XSD file.
  The XSD file contains some validation rules (type, min, max, etc.. ) and some of the elements have a default value attribute.</p>
  
  <p>Here is a short example:</p>
  
  <p>1. the XML file:</p>
  
  <pre><code>&lt;person&gt;
      &lt;first&gt;john&lt;/first&gt;
      &lt;last&gt;doe&lt;/last&gt;
      &lt;age&gt;50&lt;/age&gt;
  &lt;/person&gt;
  </code></pre>
  
  <p>The XML is being loaded in an XmlDocument object.</p>
  
  <p>2. The XSD file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1" ?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xs:element name="person" &gt;
          &lt;xs:complexType&gt;
              &lt;xs:all&gt;
                  &lt;xs:element name ="first" type="xs:string" minOccurs="0"/&gt;
                  &lt;xs:element name ="last" type="xs:string" minOccurs="0"/&gt;
                  &lt;xs:element name ="age" type="xs:integer" minOccurs="0" default="30"/&gt;
              &lt;/xs:all&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>The XSD is being loaded to an XmlSchema object.</p>
  
  <p>3. I want to retrieve the default value for age without performing validation and regular XML parsing, and if I have to perform validation, how can I retrieve the value if the node was validated successfully (the validation handler is not being called when it succeeds)?</p>
  
  <p>I tried to get the values with <code>IXmlSchemaInfo.SchemaElement</code>, but it is set to null after the validation occurred.</p>
  
  <p>OK, some clarifications:</p>
  
  <p>The default value means the default value when the user did not assign the age element. The XML could have been:</p>
  
  <pre><code>&lt;person&gt;
      &lt;first&gt;john&lt;/first&gt;
      &lt;last&gt;doe&lt;/last&gt;
      &lt;age&gt;&lt;/age&gt;
  &lt;/person&gt;
  </code></pre>
  
  <p>I'll try to be more precise:</p>
  
  <ol>
  <li>I have three text boxes, txtFirst, txtLast, and txtAge.</li>
  <li>I have a data object with three properties. First, Last and Age.</li>
  <li>The text boxes are bound to the data object which is being initialized based on the XML file, so when there is no value for "age", I want to retrieve it from the schema</li>
  </ol>