Only select text directly in node, not in child nodes

后端 未结 3 1813
余生分开走
余生分开走 2021-01-30 13:06

How does one retrieve the text in a node without selecting the text in the children?

Editor\'s Descrip
3条回答
  •  后悔当初
    2021-01-30 13:50

    Just select text() instead of .:

    div/text()
    

    On the given XML fragment, this returns:

    Lorem ipsum dolor sit amet.
    

提交回复
热议问题