Extract value of attribute node via XPath

后端 未结 7 1089
醉酒成梦
醉酒成梦 2020-11-28 01:59

How can I extract the value of an attribute node via XPath?

A sample XML file is:


  

        
7条回答
  •  佛祖请我去吃肉
    2020-11-28 02:33

    //Parent[@id='1']/Children/child/@name 
    

    Your original child[@name] means an element child which has an attribute name. You want child/@name.

提交回复
热议问题