xpath to get Node containing text

后端 未结 2 721
梦毁少年i
梦毁少年i 2020-12-05 06:09

I tried to search for nodes containing text \'Yahoo\' under \'/doc/story/content\', it returns \'content\' node, but I need exact text node that contains \'Yahoo\' or it\'s

2条回答
  •  温柔的废话
    2020-12-05 07:04

    Your XML is malformed. should be .

    Apart from that, the XPath you would want is

    /doc/story/content//*[contains(., 'Yahoo')]
    

    (select any descendant of which contains the text "Yahoo" -- this will select the

    )

提交回复
热议问题