title: Edit a xml file using c# asp.net
body: <p>Here is my xml file : <a href="https://i.stack.imgur.com/8u81S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8u81S.png" alt="picture of xml file"></a></p>
  
  <p>I want to edit this using c# and my code is like that</p>
  
  <pre><code> XmlDocument xml = new XmlDocument();
          xml.Load(Server.MapPath("xyz.XML"));
  
          foreach (XmlElement element in xml.SelectNodes("//table"))
          {
              foreach (XmlElement element1 in element)
              {
                  if (element.SelectSingleNode("//cell").InnerText == "Amit Pate")
                  {
  
                      XmlNode newname = xml.CreateElement("Name");
                      newname.InnerText = Name.Text;
                      element.ReplaceChild(newname, element1);
                      //xml.Save(Server.MapPath("xyz.XML"));
                  }
                  if (element.SelectSingleNode("//cell").InnerText == "SSE")
                  {
  
                      XmlNode newdsg = xml.CreateElement("Designation");
                      newdsg.InnerText = Designation.Text;
                      element.ReplaceChild(newdsg, element1);
                      //xml.Save(Server.MapPath("xyz.XML"));
                  }
                  if (element.SelectSingleNode("//cell").InnerText == "asp.net")
                  {
  
                      XmlNode newskill = xml.CreateElement("Skill");
                      newskill.InnerText = Skill.Text;
                      element.ReplaceChild(newskill, element1);
                      //xml.Save(Server.MapPath("xyz.XML"));
                  }
                   xml.Save(Server.MapPath("xyz.XML"));
              }
          }
  </code></pre>
  
  <p>It's not working properly. It always updated only the first node of the xml file. Please tell me what I'm missing or any other better way to edit the xml file.</p>
  
  <p>Thank you</p>