Not an expert in Java XPath impl tbh, but it might help.
javadocs say the result of getNodeValue () will be null for most node types.
It is not entirely clear what you expect to see at the exit; element name, attributes, text? I guess the text. In any XPath impl that I used, if you want the textual content of a node, you should use XPath to
Then the value of node is the text content of node.
The getTextContent () method will return the text content of the node that you selected using XPath and any descendant nodes, according to javadoc. The above solution accurately selects the text component of any FOO_ELEMENT nodes in the document.
Java EE Docs for Node <- old documents, see comments on current documents.
source share