xpath parent attribute of selection

前端 未结 3 828
不思量自难忘°
不思量自难忘° 2021-02-06 19:26

Syntax of the xml document:


  
    Z 
    Z__2
    Z__3   
           


        
3条回答
  •  感情败类
    2021-02-06 19:30

    Instead of traversing back to the parent, just find the right parent to begin with:

    • //x will select all x elements.
    • //x[//z] will select all x elements which have z elements as descendants.
    • //x[//z]/@name will get the name attribute of each of those elements.

提交回复
热议问题