LoadXmlを使用して以下のxmlをロードしています。<site> .... </site>
C#を使用した条件に基づいてノード全体を削除する必要があります。
フォロー:
XmlDocument xdoc= new XmlDocument();
xdoc.LoadXml(xmlpath);
string xml = xdoc.InnerXml.ToString();
if(xml.Contains("href"+"\""+ "www.google.com" +"\"")
{
string removenode = ""; // If href=www.google.com is present in xml then remove the entire node. Here providing the entire <site> .. </site>
xml.Replace(removenode,"");
}
ノードをnullに置き換えていません
XMLは次のとおりです。
<websites>
<site>
<a xmlns="http://www.w3.org/1999/xhtml" href="www.google.com"> Google </a>
</site>
<site>
<a xmlns="http://www.w3.org/1999/xhtml" href="www.hotmail.com"> Hotmail </a>
</site>
</websites>