How to choose two separate components in an Xpath node htmlagilitypack.com

c# html-agility-pack nodes select xpath

Question

I am trying this as selecting multiple nodes via htmlagilitypack but it fails. What is the correct syntax ? So what i am trying is collecting a nodes and li nodes inside the breadcrumbs div element. Thank you.

 string srxPathOfCategory = "//div[@class='breadcrumbs']//li or //div[@class='breadcrumbs']//a";
 var selectedNodes = myDoc.DocumentNode.SelectNodes(srxPathOfCategory);

xpath, c#, htmlagilitypack

Solution

string srxPathOfCategory = "//div[@class='breadcrumbs']//li[@class='product'] | //div[@class='breadcrumbs']//a";
1
5
1/4/2012 4:01:29 AM

Accepted Answer

Solution is

string srxPathOfCategory = "//div[@class='breadcrumbs']//li[@class='product'] | //div[@class='breadcrumbs']//a";

So for " or " you need to use " | "

12
1/4/2012 4:45:32 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow