The inner text of any other child node is not searched for by XPath.

c# html html-agility-pack xpath

Question

I'm using HtmlAgilityPack.

I hover over the parent node and its ChildNodes show several #text nodes. The XPath value shows /code[1]/#text[1]. I try to use //#text to get all the text nodes but I get that error:

Error: Expression must evaluate to a node-set.

I've tried //text and get nothing, but no error.

1
5
6/28/2012 5:07:05 PM

Accepted Answer

You need to use text() to get text nodes. To get all text nodes in the document, use //text().

From the specification:

text() matches any text node.

5
5/20/2011 9:40:49 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