Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Put OR condition in Xpath using Html AGility Pack

I have a question about HTML Agility PAck

I want to get the node collection whose Div's isPublished property is either "False" or "false".

How can I add the OR condition in XPATH. Below is my code, which does not work. It returns null.

 HtmlNodeCollection numbers = 
 htmlDoc.DocumentNode.SelectNodes("//div[@ispublished='false|False']");

Thanks

like image 377
Marcus25 Avatar asked Dec 05 '22 10:12

Marcus25


1 Answers

Try

htmlDoc.DocumentNode.SelectNodes("//div[@ispublished='false' or @ispublished='False']");
like image 71
Yuriy Galanter Avatar answered Dec 31 '22 17:12

Yuriy Galanter