sam
sam

Reputation: 193

How to negate xpath query?

I would like to do a negative xpath query like this:

$xpath->query(//a[DoesNotContain(@class,'some_class')]);

I know about this

$xpath->query(//a[contains(@class,'some_class')]);

Upvotes: 8

Views: 2431

Answers (1)

gview
gview

Reputation: 15361

$xpath->query(//a[not(contains(@class, 'some_class'))]);

Upvotes: 12

Related Questions