<?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>