Get Nth child of a node using xpath

后端 未结 2 702
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 11:38

My sample input XML is:


 
   item
   item1
   item2
   item3         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 12:09

    The following should work:

    /root/a/b[2]
    

    And if it doesn't, try:

    /root/a/b[position()=2]
    

提交回复
热议问题