删除xml节点的有关问题

删除xml节点的问题
<?xml version="1.0" encoding="gb2312"?> 
<root> 
  <bookstore n="目录"> 
  <dir id="1" n="gggg"> 
  <dir id="3"/> 
  </dir> 
  <dir id="2" n="wwww"> 
  <dir id="4"/> 
  </dir> 
  </bookstore> 
</root> 

用 XmlNode root = xmlDoc.DocumentElement.SelectSingleNode("//dir" + "[@id=2]");
  root.RemoveAll();

<?xml version="1.0" encoding="gb2312"?> 
<root> 
  <bookstore n="目录"> 
  <dir id="1" n="gggg"> 
  <dir id="3"/> 
  </dir> 
  <dir>  
  </dir> 
  </bookstore> 
</root>
请问有没有办法把xml写成 
<?xml version="1.0" encoding="gb2312"?> 
<root> 
  <bookstore n="目录"> 
  <dir id="1" n="gggg"> 
  <dir id="3"/> 
  </dir> 
  </bookstore> 
</root>


------解决方案--------------------
C# code

     XmlNode root = xmlDoc.DocumentElement.SelectSingleNode("//dir"+"[@id=2]");
     root.ParentNode.RemoveChild(root);