Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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')]);
like image 584
sam Avatar asked Sep 13 '11 01:09

sam


1 Answers

$xpath->query(//a[not(contains(@class, 'some_class'))]);
like image 86
gview Avatar answered Oct 28 '22 20:10

gview