xml文件内容如下:<?xml version="1.0" encoding="GB2312"?>
<soft version="2.0">
<chapter>
<type>C#技术资料</type>
<item>
<title>c#读写数据库操作类 </title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>利用c#打造游戏</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>
<chapter>
<type>xml文档操作</type>
<item>
<title>c#操作xml类</title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>xml各种操作(c#版)</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>
<chapter>
<type>asp.net站点制作</type>
</chapter>
<chapter>
<type>SQL数据库文章</type>
</chapter>
<chapter>
<type>DIV+CSS精华</type>
</chapter>
<chapter>
<type>C#高级编程知识</type>
</chapter>
</soft>
我现在想删除<chapter>
<type>C#技术资料</type>
<item>
<title>c#读写数据库操作类 </title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>利用c#打造游戏</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>也就是整个chapter节点,该如何来做,高手指教下,谢谢
<soft version="2.0">
<chapter>
<type>C#技术资料</type>
<item>
<title>c#读写数据库操作类 </title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>利用c#打造游戏</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>
<chapter>
<type>xml文档操作</type>
<item>
<title>c#操作xml类</title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>xml各种操作(c#版)</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>
<chapter>
<type>asp.net站点制作</type>
</chapter>
<chapter>
<type>SQL数据库文章</type>
</chapter>
<chapter>
<type>DIV+CSS精华</type>
</chapter>
<chapter>
<type>C#高级编程知识</type>
</chapter>
</soft>
我现在想删除<chapter>
<type>C#技术资料</type>
<item>
<title>c#读写数据库操作类 </title>
<id>1</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>男 </content>
</item>
<item>
<title>利用c#打造游戏</title>
<id>2</id>
<from>不知道</from>
<time>2009-1-11</time>
<content>女 </content>
</item>
</chapter>也就是整个chapter节点,该如何来做,高手指教下,谢谢
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filename);
XmlNodeList xn0 = xmlDoc.SelectSingleNode("soft").ChildNodes;
xn0[0].RemoveAll();