Html Agility Pack RemoveAll
public void RemoveAll()
Removes all the children and/or attributes of the current node. RemoveAll method is a member of HtmlAgilityPack.HtmlNode
The following example removes the first child node from the parent collection, as well as all its children and attributes.
var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(html); var htmlBody = htmlDoc.DocumentNode.SelectSingleNode("//body"); HtmlNode node = htmlBody.ChildNodes; node.RemoveAll();
Click here to run this example.