Parsing HTML in C#
This is useful for html parsing
code
var web = new HtmlWeb();
var doc = web.Load("http://www.stack.com");
HtmlDocument document = new HtmlDocument();
string htmlString = doc.toString();
document.LoadHtml(htmlString);
HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//a");
foreach (HtmlNode link in collection)
{
string target = link.Attributes["href"].Value;
}
No comments:
Post a Comment