C# HTMLAgilityPack Select not contains

c# console html-agility-pack xpath

Question

I'm not sure how to accomplish my aim with my software, which is a straightforward C# terminal application. Basically, I'm picking a single node but I'd want to disregard a tag with a certain text value.

string name = item.SelectSingleNode("//select[contains(@id,'var')]//option")
                  .GetInnerTextFromNode();

I'm aware that you can use:not filter in jQuery, but I'm not sure whether you can in C#. I've looked for pack documentation online, but nothing has shown up.

Many thanks

1
1
12/11/2013 1:13:21 PM

Popular Answer

Just using RGraham's remark as a starting point for a response

 string name = item.SelectSingleNode("//select[not(contains(@id,'var'))]//option")
              .GetInnerTextFromNode();

Check out the lessons on XPath at w3schools for advice on what kinds of functions you can utilize.

3
1/20/2016 3:00:42 PM


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