Hope somebody can help me.
Let´s say I have a html document that contains multiple divs like this example:
If you use //
, it searches from the document begin.
Use .//
to search all from the current node
foreach (HtmlAgilityPack.HtmlNode node2 in node.SelectNodes(".//span[@prop]"))
Or drop the prefix entirely to search just for direct children:
foreach (HtmlAgilityPack.HtmlNode node2 in node.SelectNodes("span[@prop]"))