title: How to convert extended CSV to XML in mule
body: <p>I have to read a CSV file with 6 different structured formats and convert to XML format. I need a help to read multi-structured CSV file in mule.</p>
  
  <p>Sample input: </p>
  
  <blockquote>
    <p>01,12345,Cap,01-02-2017<br>
    02,12345,subject1, subject2,subject3,subject4,subject5<br>
    03,12345,65432,45,ABS<br>
    04,12345,ABC,DEF,,<br>
    05,12345,5325,ABC,<br>
    06,12345,87.9,ASDF,LKJ<br>
    06,12345,99,ABC,WERT  </p>
  </blockquote>
  
  <p>Expected Output: </p>
  
  <pre><code>&lt;Root&gt;
    &lt;Sample&gt;
      &lt;Number&gt;12345&lt;/Number&gt;
      &lt;B&gt;Cap&lt;/B&gt;
      &lt;C&gt;01-02-2017&lt;/C&gt;
    &lt;/Sample&gt;
    &lt;Example&gt;
      &lt;Sub&gt;
        &lt;Number&gt;12345&lt;/Number&gt;
        &lt;S1&gt;subject1&lt;/S1&gt;
        &lt;S2&gt;subject2&lt;/S2&gt;
        &lt;S3&gt;subject3&lt;/S3&gt;
        &lt;S4&gt;subject4&lt;/S4&gt;
        &lt;S5&gt;subject5&lt;/S5&gt;
      &lt;/Sub&gt;
      &lt;Sub1&gt;
        &lt;Number&gt;12345&lt;/Number&gt;
        &lt;A1&gt;65432&lt;/A1&gt;
        &lt;A2&gt;45&lt;/A2&gt;
        &lt;A3&gt;ABS&lt;/A3&gt;
     &lt;/Sub1&gt;
     &lt;Sub2&gt;
       &lt;Number&gt;12345&lt;/Number&gt;
       &lt;B1&gt;ABC&lt;/B1&gt;
       &lt;B2&gt;DEF&lt;/B2&gt;
       &lt;B3/&gt;
     &lt;/Sub2&gt;
     &lt;Sub3&gt;
       &lt;Number&gt;12345&lt;/Number&gt;
       &lt;C1&gt;5325&lt;/C1&gt;
       &lt;C2&gt;ABC&lt;/C2&gt;
     &lt;/Sub3&gt;
     &lt;Sub4&gt;
      &lt;Sub_rec&gt;
        &lt;Number&gt;12345&lt;/Number&gt;
        &lt;D1&gt;87.9&lt;/D1&gt;
        &lt;D2&gt;ASDF&lt;/D2&gt;
        &lt;D3&gt;LKJ&lt;/D3&gt;
      &lt;/Sub_rec&gt;
      &lt;Sub_rec&gt;
        &lt;Number&gt;12345&lt;/Number&gt;
        &lt;D1&gt;99&lt;/D1&gt;
        &lt;D2&gt;ABC&lt;/D2&gt;
        &lt;D3&gt;WERT&lt;/D3&gt;
      &lt;/Sub_rec&gt;
    &lt;/Sub4&gt;
   &lt;/Example&gt;
  &lt;/Root&gt;
  </code></pre>