Friday, May 3, 2013

How to extract text from html by HtmlAgilityPack?


            string htmlstring ="

adsasd

"; HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(htmlstring); foreach (var script in doc.DocumentNode.Descendants("script").ToArray()) script.Remove(); foreach (var style in doc.DocumentNode.Descendants("style").ToArray()) style.Remove(); string ExtractedText = doc.DocumentNode.InnerText;

No comments:

Post a Comment