c# htmlagilitypack xpath select all except with certain class

c# html-agility-pack

Question

I am trying to select all li tags on a page that do not have the class="r"

What i have so far is:

.//li

This is what ive tried so far

//li[not([@class='r'])]

With that i get the error:

"Expression must evaluate to a node-set."

1
0
5/20/2013 12:50:31 PM

Accepted Answer

use this expression //li[not(@class='r')]

var lis = htmlDoc.DocumentNode.SelectNodes("//li[not(@class='r')]")
3
5/20/2013 12:58:46 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow