How to select a node using XPath if sibling node has a specific value?

后端 未结 6 1129
温柔的废话
温柔的废话 2020-12-04 08:15

I have the following document:


  abc
  ccc
  
ffffd
zz
6条回答
  •  被撕碎了的回忆
    2020-12-04 09:07

    What you need is following-sibling XPath axis

    //a/bb[text()="zz"]/following-sibling::cc[1]/text()
    

    Test the Xpath here: http://www.xpathtester.com/obj/b55ec3ac-dfa4-4f44-81e8-f963ea4a0625

提交回复
热议问题