>>>>但是这样的话删除该节点后会留下<class></class>这样的一个空节点are you sure? your code should workXmlDocument doc=new XmlDocument();
doc.Load(...);
XmlNode ndd=doc.SelectSingleNode("/root/class[@id='d']");
doc.DocumentElement.RemoveChild(ndd);//只能删除class节点。
ndd.RemoveAll();
doc.Save(...);
orXmlNode ndd=doc.SelectSingleNode("/root/class[@id='d']");
if (ndd != null)
ndd.ParentNode.RemoveChild(ndd);
doc.Save(...);
doc.Load(...);
XmlNode ndd=doc.SelectSingleNode("/root/class[@id='d']");
doc.DocumentElement.RemoveChild(ndd);//只能删除class节点。
ndd.RemoveAll();
doc.Save(...);
orXmlNode ndd=doc.SelectSingleNode("/root/class[@id='d']");
if (ndd != null)
ndd.ParentNode.RemoveChild(ndd);
doc.Save(...);
thank you for your answer,using second way.
father more,i want to know more about how your learning xml,because i can't find
the best way to understand xml in asp.net,many book only tell me xml.
and i want to know which webstation(网站)your often visit.
the last ,my english is poor,can your tell a way to study it.i think many many pepole have the same question,so if you are free,can you answer it?