Extract value of attribute node via XPath

后端 未结 7 1069
醉酒成梦
醉酒成梦 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:07

    You should use //Parent[@id='1']/Children/child/data(@name)

    The attributes can not be serialized so you can't return them in an xml looking result. What you need to do is obtain the data from the attribute using data() function.

提交回复
热议问题