title: Delete a node and its child nodes
body: <p>I want to remove a node from an XML file. </p>
  
  <p>Here is what the XML file looks like.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;MovieData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;Movie&gt;
      &lt;Name&gt;Death Race&lt;/Name&gt;
      &lt;Type&gt;Action&lt;/Type&gt;
      &lt;Type&gt;Adventure&lt;/Type&gt;
      &lt;Rating&gt;R&lt;/Rating&gt;
      &lt;Disk&gt;Blu-Ray&lt;/Disk&gt;
    &lt;/Movie&gt;
    &lt;Movie&gt;
      &lt;Name&gt;Movie to be deleted&lt;/Name&gt;
      &lt;Type&gt;Action&lt;/Type&gt;
      &lt;Type&gt;Adventure&lt;/Type&gt;
      &lt;Rating&gt;R&lt;/Rating&gt;
      &lt;Disk&gt;Blu-Ray&lt;/Disk&gt;
    &lt;/Movie&gt;
    &lt;Movie&gt;
      &lt;Name&gt;Death Race 2&lt;/Name&gt;
      &lt;Type&gt;Action&lt;/Type&gt;
      &lt;Type&gt;Adventure&lt;/Type&gt;
      &lt;Rating&gt;R&lt;/Rating&gt;
      &lt;Disk&gt;Blu-Ray&lt;/Disk&gt;
      &lt;Time&gt;time&lt;/Time&gt;
    &lt;/Movie&gt;
  &lt;/MovieData&gt;
  </code></pre>
  
  <p>I want it to end up like this.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;MovieData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;Movie&gt;
      &lt;Name&gt;Death Race&lt;/Name&gt;
      &lt;Type&gt;Action&lt;/Type&gt;
      &lt;Type&gt;Adventure&lt;/Type&gt;
      &lt;Rating&gt;R&lt;/Rating&gt;
      &lt;Disk&gt;Blu-Ray&lt;/Disk&gt;
      &lt;Time&gt;time&lt;/Time&gt;
    &lt;/Movie&gt;
    &lt;Movie&gt;
      &lt;Name&gt;Death Race 2&lt;/Name&gt;
      &lt;Type&gt;Action&lt;/Type&gt;
      &lt;Type&gt;Adventure&lt;/Type&gt;
      &lt;Rating&gt;R&lt;/Rating&gt;
      &lt;Disk&gt;Blu-Ray&lt;/Disk&gt;
      &lt;Time&gt;time&lt;/Time&gt;
    &lt;/Movie&gt;
  &lt;/MovieData&gt;
  </code></pre>
  
  <p>This is what I have so far. This only deletes the child nodes though. It doesn't delete the  node.</p>
  
  <pre><code>XmlDocument doc = new XmlDocument();
  doc.Load(movieListXML);
  XmlNode node = doc.SelectSingleNode("/MovieData");
  foreach (XmlNode movie in node.SelectNodes("Movie"))
  {
      if (movie != null)
      {
          if (name == movie["Name"].InnerText)
          {
              if ((this checks the data to make sure it is the one to be deleted))
              {
                  movie.RemoveAll();
                  doc.Save(movieListXML);
                  return;
              }
          }
      }
  }
  </code></pre>