Reading XML string into a list
<p>I have a string xml </p>

<pre><code>&lt;message code="L1" /&gt;
&lt;message code="D1" /&gt;
&lt;message code="A1"&gt;NAME: JON              ID: 99017   CODE: 111222333    TYPE: ST&lt;/message&gt;
&lt;message code="A2"&gt;NTC:           RISK:               START: 09/01/2015     STATUS: ACTIVE&lt;/message&gt;
&lt;message code="CD"&gt;STATE: MS     LAST CANCEL REASON:&lt;/message&gt;
&lt;message code="A4"&gt;A, TIM                   (PRIMARY)      OS      09/01/2015    09/01/2016&lt;/message&gt;
&lt;message code="D1" /&gt;
&lt;message code="A1"&gt;NAME: Tim              ID: 99017   CODE: 111222333    TYPE: ST&lt;/message&gt;
&lt;message code="A2"&gt;NTC:           RISK:               START: 09/01/2015     STATUS: EXPIRED&lt;/message&gt;
&lt;message code="CD"&gt;STATE: MS     LAST CANCEL REASON:&lt;/message&gt;
&lt;message code="A4"&gt;A, TIM                   (PRIMARY)      OS      09/01/2014    09/01/2015&lt;/message&gt;               
&lt;message code="D1" /&gt;
</code></pre>

<p>I want to read this string xml into a list. If you see this xml, it contains 2 parts</p>

<pre><code>&lt;message code="A1"&gt;NAME: JON              ID: 99017   CODE: 111222333    TYPE: ST&lt;/message&gt;
&lt;message code="A2"&gt;NTC:           RISK:               START: 09/01/2015     STATUS: ACTIVE&lt;/message&gt;
&lt;message code="CD"&gt;STATE: MS     LAST CANCEL REASON:&lt;/message&gt;
&lt;message code="A4"&gt;A, TIM                   (PRIMARY)      OS      09/01/2015    09/01/2016&lt;/message&gt;
&lt;message code="D1" /&gt;
</code></pre>

<p>And</p>

<pre><code>&lt;message code="A1"&gt;NAME: Tim              ID: 99017   CODE: 111222333    TYPE: ST&lt;/message&gt;
&lt;message code="A2"&gt;NTC:           RISK:               START: 09/01/2015     STATUS: EXPIRED&lt;/message&gt;
&lt;message code="CD"&gt;STATE: MS     LAST CANCEL REASON:&lt;/message&gt;
&lt;message code="A4"&gt;A, TIM                   (PRIMARY)      OS      09/01/2014    09/01/2015&lt;/message&gt;               
&lt;message code="D1" /&gt;
</code></pre>

<p>I want to get the elements into list as </p>

<pre><code>var subjects= new List&lt;subject&gt;();
subjects.Add(new subject()
{
  Name = JON,
  State = MS
 })
</code></pre>

<p>I tried by foreach on xmlnode and then using substring to get the values.</p>