I have a table where in one column, I have saved all the html of a page. I want to fetch a div( and its contents) from that div using htmlagility how can I do this. I don't want to load it from url or do screen scraping.
2 Answers
I found this solution.
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(@html);
HtmlNodeCollection tableRows = doc.DocumentNode.SelectNodes("//tr");
string content = "";
if (tableRows.Count > 1)
{
HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[@class='account-detail']");
content = node.InnerHtml;
}
thank you all for your time.