Skip to content Skip to sidebar Skip to footer

How To Get Count Number Of Selectednode With Xpath In C#?

I am using HTMLAgilityPack in my application, and i want to get the item(node) count of SelectedNodes as the code below: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.Html

Solution 1:

I don't know the specific way in HTMLAgilityPack but in plain XPath you can do this:

count(//div[@class='o'])

You properly can't use this XPath in .SelectNodes but there should be a method like Evaluate, SelectSingle or SelectAtom.

Post a Comment for "How To Get Count Number Of Selectednode With Xpath In C#?"