title: Generating XML from SQL existing XSD file (complex)
body: <p>I have an XSD file. I get data from SQL and fill data to dataset. 
  note: I get 1000 records from SQL. </p>
  
  <p>I want to make this; generate XML file exisiting xsd format. </p>
  
  <p>Here is my XSD.:</p>
  
  <pre><code> &lt;xs:element name = 'automation'&gt;
    &lt;xs:complexType&gt;
       &lt;xs:sequence&gt;
            &lt;xs:element name = 'auto' type = 'AutoType' minOccurs = '1' maxOccurs = 'unbounded' /&gt;
       &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;xs:complexType name = "AutoType"&gt;
    &lt;xs:sequence&gt;
       &lt;xs:element name = "autoKodu" type = "xs:string" minOccurs = '1' maxOccurs = '1' /&gt; &lt;!-- v --&gt;
       &lt;xs:element name = "autoAdres" type = "xs:string" minOccurs = '1' maxOccurs = '1' /&gt; &lt;!-- v --&gt;
       &lt;xs:element name = 'bill' type = 'BillType' minOccurs = '1' maxOccurs = 'unbounded' /&gt;
    &lt;/xs:sequence&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code> &lt;xs:complexType name = "BillType"&gt;
    &lt;xs:sequence&gt;
       &lt;xs:element name = "dateOne" type = "xs:date" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = "dateTwo" type = "xs:time" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = 'point' type = 'PointType' minOccurs = '1' maxOccurs = 'unbounded' /&gt;
  
    &lt;/xs:sequence&gt;
  </code></pre>
  
  <p>    </p>
  
  <pre><code>&lt;xs:complexType name = "PointType"&gt;
    &lt;xs:sequence&gt;
        &lt;xs:element name = "plate"  minOccurs = '1' maxOccurs = '1' &gt; &lt;!-- v --&gt;
       &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:pattern value="([a-zA-Z0-9])*"/&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
        &lt;/xs:element&gt;
       &lt;xs:element name = "aa" type = "xs:string" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = "bb" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = "cc" type = "xs:string" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = "dd" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt;
       &lt;xs:element name = "ee" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt; 
       &lt;xs:element name = "ff" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt;
       &lt;xs:element name = "gg" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt;
       &lt;xs:element name = "hh" type = "xs:decimal" minOccurs = '1' maxOccurs = '1' /&gt;
    &lt;/xs:sequence&gt;
  </code></pre>
  
  <p>    </p>
  
  <p>I have created xsd class using xsd.exe 
  I added it to solution.</p>
  
  <pre><code>var data = new myClassOrSmthng? { ??? I do not know how to get datas from dataset here. }
  
  XmlSerializer serializer = new XmlSerializer(typeof(myClassOrSmthng));
                  using (var stream = new StreamWriter(myPath)) serializer.Serialize(stream, data);
  </code></pre>