title: Reading XML Attributes into a List
body: <p>I'm new to XML and am having trouble reading my XML response back from a HttpWebResponse.</p>
  
  <p>Here is the response back:</p>
  
  <pre><code>&lt;RESPONSE version="1.2"&gt;
   &lt;RESULTS&gt;
    &lt;AN an_type="C" 
    an_id="783hdryfdg56a2" 
     an_num="1" 
      an_status="100" /&gt;
    &lt;RESULTS&gt;
  &lt;/RESPONSE&gt;
  </code></pre>
  
  <p>I'm looking to extract out the an_id value and save it to a list. Started doing this but seems to get an for xmlnodelist as an int but it thinks nodes["an_id"] is a string</p>
  
  <pre><code>List&lt;int&gt; IDs = new List&lt;int&gt;();
  XmlDocument doc = new XmlDocument();
  doc.LoadXml(returnValue);
  XmlNodeList nodes = doc.SelectNodes("SEARCH_RESULTS/LOAN");
  LoanIDs.Add(Convert.ToInt32(nodes["an_id"].InnerText));
  </code></pre>
  
  <p>Also is their a way to once the an_id's are added to a list. foreach item in the list use it as aparameter for a new xml like this:</p>
  
  <pre><code>&lt;INPUT&gt;
          &lt;LOGIN API_ID=""cat"" API_PASSWORD=""dog"" /&gt;
      &lt;REQUEST&gt;
           &lt;AN an_id=""@anID"" /&gt;  
           &lt;AN an_id=""@anID"" /&gt;
          ....foreach one in list it adds a new node with the value
      &lt;/REQUEST&gt;
  &lt;/INPUT&gt;
  </code></pre>