title: How to parse an XSD to get the information from <xsd:simpleType> elements using C#?
body: <p>I have an XSD with multiple complex types and simple types (part of the file shown below). I need to  parse this document to get maxLength from each of the simpletypes that are referenced in the complex types. Can anyone please throw some advice on how to implement this? I need to implement this in a generic way so if I query on "Setup_Type" it should give the below output. Thank you!</p>
  
  <p>NewSetup/Amount = 12 (The name attributes from element tags separated by "/" and maxLength from the nested simpleType)</p>
  
  <p>NewSetup/Name = 50</p>
  
  <pre><code>&lt;xsd:complexType name="Setup_Type"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="NewSetup" type="NewSetup_Type" minOccurs="1" maxOccurs="1" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  
  &lt;xsd:complexType name="NewSetup_Type"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="Amount" type="Amount_Type"  minOccurs="1" maxOccurs="1" /&gt;
      &lt;xsd:element name="Name" type="Name_Type"  minOccurs="1" maxOccurs="1" /&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  
  &lt;xsd:simpleType name="Amount_Type"&gt;
    &lt;xsd:annotation&gt;
      &lt;xsd:documentation&gt;Amount&lt;/xsd:documentation&gt;
    &lt;/xsd:annotation&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:maxLength value="12" /&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;
  
  &lt;xsd:simpleType name="Name_Type"&gt;
    &lt;xsd:annotation&gt;
      &lt;xsd:documentation&gt;Name&lt;/xsd:documentation&gt;
    &lt;/xsd:annotation&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:maxLength value="50" /&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;
  </code></pre>