"# text" is simply the result of calling the getNodeName () method in the node text. (As you will see if you look at the API documentation for org.w3c.dom.Node.) If you want the actual textual content of the node, you must use the getNodeValue () method.
And if you did not expect any text nodes, do not forget that even small pieces of spaces, such as newlines, are treated as text.
source
share