4
votes

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

2

2 Answers

12
votes

Try

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

Have you tried:

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

More on xpath or