title: Remove nodes in an XML file?
body: <p>I have xml file and want to remove some nodes:</p>
  
  <pre><code>&lt;group&gt;
    &lt;First group&gt;
    &lt;/First group&gt;
    &lt;Second group&gt;
      &lt;Name&gt;
      &lt;/Name&gt;
      &lt;Name&gt;
      &lt;/Name&gt;
      &lt;Name&gt;
      &lt;/Name&gt;
    &lt;/Second group&gt;
  &lt;/group&gt;
  </code></pre>
  
  <p>I want to remove nodes <code>Name</code>, because later I want to create new nodes.</p>
  
  <p>Here is the code what I have what I have:</p>
  
  <pre><code>Dim doc As New XmlDocument()
  Dim nodes As XmlNodeList
  doc.Load("doc.xml")
  nodes = doc.SelectNodes("/group")
  Dim node As XmlNode
  
  For Each node In nodes
    node = doc.SelectSingleNode("/group/Second group/Name")
    If node IsNot Nothing Then
      node.ParentNode.RemoveNode(node)
      doc.Save("doc.xml")
    End If
  Next
  </code></pre>