XPath testing that string ends with substring?

前端 未结 5 540
一整个雨季
一整个雨季 2021-01-17 17:06

Given that the HTML contains:

  
<
5条回答
  •  自闭症患者
    2021-01-17 17:32

    XPath 2.0

    //div[ends-with(@tagname, 'Destination')]
    

    XPath 1.0

    //div[substring(@tagname, string-length(@tagname) 
                              - string-length('Destination') + 1)  = 'Destination']
    

提交回复
热议问题