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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.