looping through parent child combination xml using c#
<p>I am new to xml, i want to looping through the below xml and save the records in the database. the below xml is parent child combination, parts as to be saved under respective parents. if the source field is M then there will be child item for that.</p>

<pre><code>  &lt;PARENT&gt;
 &lt;COMPONENT&gt;
  &lt;part&gt;test1&lt;/part&gt;&lt;source&gt;M&lt;/source&gt;&lt;ParentPart&gt;parent&lt;/ParentPart&gt;
  &lt;SUBCOMPONENT&gt;
   &lt;part&gt;test2&lt;/part&gt;&lt;source&gt;B&lt;/source&gt;&lt;ParentPart&gt;test1&lt;/ParentPart&gt;
  &lt;/SUBCOMPONENT&gt;

  &lt;SUBCOMPONENT&gt;
   &lt;part&gt;test3&lt;/part&gt;&lt;source&gt;M&lt;/source&gt;&lt;ParentPart&gt;test1&lt;/ParentPart&gt;
   &lt;SUBSUBCOMPONENT&gt;
    &lt;part&gt;test4&lt;/part&gt;&lt;source&gt;B&lt;/source&gt;&lt;ParentPart&gt;test3&lt;/ParentPart&gt;
   &lt;/SUBSUBCOMPONENT&gt;
  &lt;/SUBCOMPONENT&gt;

 &lt;/COMPONENT&gt;

 &lt;COMPONENT&gt;
  &lt;part&gt;part1&lt;/part&gt;&lt;source&gt;B&lt;/source&gt;&lt;ParentPart&gt;parent&lt;/ParentPart&gt;
 &lt;/COMPONENT&gt;

 &lt;COMPONENT&gt;
   &lt;part&gt;part2&lt;/part&gt;&lt;source&gt;M&lt;/source&gt;&lt;ParentPart&gt;parent&lt;/ParentPart&gt;
  &lt;SUBCOMPONENT&gt;
   &lt;part&gt;part3&lt;/part&gt;&lt;source&gt;B&lt;/source&gt;&lt;ParentPart&gt;part2&lt;/ParentPart&gt;
  &lt;/SUBCOMPONENT&gt;

  &lt;SUBCOMPONENT&gt;
   &lt;part&gt;part4&lt;/part&gt;&lt;source&gt;M&lt;/source&gt;&lt;ParentPart&gt;part2&lt;/ParentPart&gt;
   &lt;SUBSUBCOMPONENT&gt;
    &lt;part&gt;part5&lt;/part&gt;&lt;source&gt;B&lt;/source&gt;&lt;ParentPart&gt;part4&lt;/ParentPart&gt;
   &lt;/SUBSUBCOMPONENT&gt;
  &lt;/SUBCOMPONENT&gt;

 &lt;/COMPONENT&gt;

&lt;/PARENT&gt;
</code></pre>

<p>any help would be appropriated.</p>

<p>Thanks,</p>

<p>Pradeep</p>
