html agility pack: how to extract raw text

html-agility-pack

Question

Quick question, how do I get all raw text (i.e., removing all html tags) using html agility pack?

HtmlDocument doc = new HtmlDocument();
        doc.Load(html);

Accepted Answer

If you download source code from Html Agility Pack page (look for "Html Agility Pack 1.4.0 Source" file) there is folder Html2Txt that contains the code you need (look for the HtmlToText class in HtmlConvert.cs file).



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why