Node.getTextContent() is there a way to get text content of the current node, not the descendant's text

后端 未结 4 754
眼角桃花
眼角桃花 2021-02-02 14:53

Node.getTextContent() returns the text content of the current node and its descendants.

is there a way to get text content of the current node, not the descendant\'s tex

4条回答
  •  无人及你
    2021-02-02 15:41

    Implicitly don't have any function for the actual node text but with a simple trick you can do it. Ask if the node.getTextContent() contains "\n", if that is the case then the actual node don't have any text.

    Hope this help.

提交回复
热议问题