You can try changing the XPath expression to
"string(/rss/channel/title)"
and use the return type STRING instead of NODE:
Node node = (Node) xPath.evaluate("string(/rss/channel/title)", doc, XPathConstants.STRING);
Thus, you do not select the text node, but rather the string value of the title element, consisting of the concatenation of all its streaming text nodes.
source share