AgainMe AgainMe - 3 months ago 10
C# Question

Prevent HtmlAgilityPack to select particular class

I need to select all

tr
inside a table, actually for doing this I wrote this code:

var tr = doc.DocumentNode.SelectNodes("//tr");


this working good, but I need to skip the tr that have this class:
round-head expanded loaded
.

Is possible tell to
HtmlAgilityPack
to select all tr that doesn't have the class specified above? thanks.

Answer

Simply use the Xpath to check the value of an attribute:

//tr[@class != 'round-head expanded loaded']