How to Put OR condition in Xpath using Html AGility Pack

c# html-agility-pack

Question

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

Accepted Answer

Try

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

Popular Answer

Have you tried:

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

More on xpath or




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why