title: XML Replace in c#
body: <p>Im trying to use the ReplaceChild function. the code works, and no exceptions are thrown, but when I print XML to the screen it seems as if the function didnt work. the original node is the but not the new one.</p>
  
  <pre><code>private void convertClubComp(XmlDocument doc)
      {
          XmlNode sessionNode = doc.SelectSingleNode("Session");
          XmlNode clubsNode = doc.CreateNode(XmlNodeType.Element, "Clubs", "");
          XmlNode playerNode = sessionNode.SelectSingleNode("Players").SelectSingleNode("Player");
          XmlNode groupNode = sessionNode.SelectSingleNode("Players").SelectSingleNode("Player").SelectSingleNode("Groups");
  
          Console.WriteLine(playerNode.Name);
  
          clubsNode = doc.ImportNode(groupNode, true);
          playerNode.ReplaceChild(clubsNode, sessionNode.SelectSingleNode("Players").SelectSingleNode("Player").SelectSingleNode("Groups"));
          Console.WriteLine(clubsNode.FirstChild.FirstChild.Name);
  
          Console.WriteLine("!"+playerNode.FirstChild.NextSibling.NextSibling.NextSibling.NextSibling.NextSibling.Name);
  
  
      }
  </code></pre>
  
  <p>Thanks</p>