删除xml节点
-<PARTY PARENT="DETAIL">
<CODE>98CA</CODE>
<LABEL>BROKER</LABEL>
<ID> </ID>
<NAME> </NAME>
<NAME2> </NAME2>
<ADDRLINE1> </ADDRLINE1>
<ADDRLINE2> </ADDRLINE2>
<ADDRLINE3> </ADDRLINE3>
<ADDRLINE4> </ADDRLINE4>
<CITY> </CITY>
<PROVSTATE> </PROVSTATE>
<COUNTRY> </COUNTRY>
<POSTALCODE> </POSTALCODE>
<LOCCODESTD> </LOCCODESTD>
<LOCCODE> </LOCCODE>
<CONTPERSON> </CONTPERSON>
<CONTPHONE> </CONTPHONE>
</PARTY>
</DETAIL>
-<DETAIL>
要删除包含 <CODE>98CA</CODE>的party的节点! 当判断的时候,该怎么写?
xmlDoc.Load(xmlFileName); //加载XML文档
XmlNodeList nodes;
XmlElement root = xmlDoc.DocumentElement;
nodes = root.SelectNodes("//PARTY//CODE");
// nodes = root.SelectNodes();
foreach (XmlNode node in nodes)
{
node.ParentNode.RemoveChild(node);
}
不知道98CA的条件怎么添加上去,请高手指点! 在线等
xml
?节点
------解决方案--------------------nodes = root.SelectNodes("//PARTY//CODE");
====>
nodes = root.SelectNodes("//PARTY[.//CODE='98CA']");