To get the string value of div
use:
string(/div)
This is the concatenation of all text nodes that are descendents of the (top) div
element.
To select all text node descendents of div
use:
/div//text()
To get only the text nodes that are direct children of div
use:
/div/text()
Finally, get the first (and hopefully only) non-whitespace-only text node child of div
:
/div/text()[not(normalize-space())][1]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…