Skip to content Skip to sidebar Skip to footer

Htmlagilitypack: Get All Elements By Class

I have an HTML, and i need to get some nodes by class. So i can't do it because I dunno XML path Items needed has no ID, only class HtmlAgilityPack do not allow to get all elemen

Solution 1:

Learn XPath! :-) It's really simple, and will serve you well. In this case, what you want is:

SelectNodes("//*[@class='" + classValue + "']") ?? Enumerable.Empty<HtmlNode>();

Post a Comment for "Htmlagilitypack: Get All Elements By Class"