title: How to parse XML using C# when XML contains same element again?
body: <p>I am trying to read an XML file which is looking like,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;MyXML&gt;
  &lt;SESSION FORM_ID="775938" CID="" ID="HAKKI-LAPTOP_634975758376381105"&gt;
  &lt;FIELD NAME="A001DATE_M" Y="2.32" X="5.5" WIDTH="7.15" HEIGHT="0.99"&gt;First Value&lt;/FIELD&gt;
  &lt;FIELD NAME="A002" Y="2.32" X="17.83" WIDTH="2.38" HEIGHT="0.99"&gt;Second Value&lt;/FIELD&gt;
  &lt;FIELD NAME="A003" Y="1.11" X="17.83" WIDTH="2.38" HEIGHT="0.99"&gt;Third Value&lt;/FIELD&gt;
  &lt;FIELD NAME="A004" Y="1.11" X="5.5" WIDTH="2.38" HEIGHT="0.99"&gt;Fourth Value&lt;/FIELD&gt;
  &lt;/SESSION&gt; 
  &lt;/MyXML&gt;
  </code></pre>
  
  <p>I am trying to read the read the third value.
  My Code ables to retrieve the first value.</p>
  
  <pre><code>XmlDocument xmlDoc = new XmlDocument();
  xmlDoc.Load(sXMLPath);
  XmlNode node = xmlDoc.SelectSingleNode("MyXML/SESSION/FIELD");
  if (node != null)
  {
       MessageBox.Show(node.InnerText);
  }
  </code></pre>
  
  <p>What Changes do I need to make in order to read the third or fourth value?</p>
  
  <p><strong>Solution:</strong> (Provided by @DGibbs)</p>
  
  <pre><code>XDocument xml = XDocument.Load(sXMLPath);
  var elem = (from n in xml.Descendants("FIELD")
              where n.Attribute("NAME").Value == "A004"
              select n).FirstOrDefault();
  MessageBox.Show(elem.Value);
  </code></pre>