23 Ağustos 2018 Perşembe

HTML Agility pack C# code to remove comments:

This is the C# code to remove comments: How to use HTML Agility pack
    HtmlDocument doc = new HtmlDocument();
    doc.Load("yourFile.htm");

    // get all comment nodes using XPATH
    foreach (HtmlNode comment in doc.DocumentNode.SelectNodes("//comment()"))
    {
        comment.ParentNode.RemoveChild(comment);
    }
    doc.Save(Console.Out); 

Hiç yorum yok:

Yorum Gönder