XPath looks for all text in node s, not the inner text of any other child node

I am using HtmlAgilityPack.

Hover over the parent node, and its child nodes show multiple nodes #text. XPath value shows /code[1]/#text[1]. I am trying to use //#textto get all text nodes, but getting this error:

Error: Expression must evaluate to a node-set.

I tried //textand did not get anything, but there was no error.

+5
source share
1 answer

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

From specification :

text() node.

+5