Answer the question
In order to leave comments, you need to log in
Where can I read the Html Agility Pack documentation?
Good afternoon!
Please tell me where you can read the Html Agility Pack documentation in Russian or good lessons (examples)
Answer the question
In order to leave comments, you need to log in
In theory, the main thing is to be able to build XPath expressions.
With them it is very easy to get any information that is at least somehow typed, for example:
var pageNodes = document.DocumentNode.SelectNodes("//div[@id=\"pagination_related\"]//a");
if (pageNodes != null)
{
foreach (var node in pageNodes)
pages.Add(new Uri(this.Uri + node.Attributes[0].Value));
pages = pages.Distinct().ToList();
}
var chapterNodes = document.DocumentNode.SelectNodes("//div[@class=\"related_info\"]");
if (chapterNodes != null)
{
foreach (var node in chapterNodes)
{
var link = node.SelectSingleNode(".//h2//a");
var desc = node.SelectSingleNode(".//div[@class=\"related_tag_list\"]");
chapters.Add(new Chapter(new Uri(this.Uri, link.Attributes[0].Value), desc.InnerText));
}
}
The class reference is on the pages of the NuDoq project - in fact, a convenient display of XML documentation from the NuGet Html Agility Pack.
A very brief and, perhaps, slightly outdated overview of some features of the Html Agility Pack (on the other hand, in Russian) is on Habré.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question