title: Select xml node by its element contnt
body: <p>I have an xml file like this one:</p>
  
  <pre><code>    &lt;root&gt;
         &lt;sub&gt;
            &lt;name&gt;Al&lt;/name&gt;
            &lt;code&gt;001&lt;/code&gt;
         &lt;/sub&gt;
         &lt;sub&gt;
            &lt;name&gt;John&lt;/name&gt;
            &lt;code&gt;002&lt;/code&gt;
         &lt;/sub&gt;
  </code></pre>
  
  <p>and a <code>List&lt;string&gt; lName= new List&lt;string&gt;(new string[] { "Jack", "John"});</code></p>
  
  <p>I want to edit "John" node, add "Jack" node and leave "Al" node as it is. What I did is:  </p>
  
  <pre><code>System.Xml.XmlNodeList nodeNameList = FileXml.SelectNodes(@"//*[contains(name(),'name')]");
  foreach (string name in lName)
  {
     System.Xml.XmlNode nodeName=FileXml.SelectSingleNode("//root/sub/name");                 
     if (nodeName.InnerText == name)
     {
          //add
     }
     else
     {
          //edit              
     }
  </code></pre>
  
  <p>But it doesn't work. I thought that XmlNodeList works as a normal list but it doesn't. Can someone help me?</p>