I have a xml structure like below
<?xml version="1.0" encoding="UTF-8"?>
<Result>
<node>
<field value="79055_v01" name="Id" />
</node>
<node>
<field value="79055" name="Id" />
</node>
<node>
<field value="79155" name="Id" />
</node>
<node>
<field value="811" name="Id" />
</node>
<node>
<field value="811_v16" name="Id" />
<field value="811" name="abc" />
</node>
</Result>
I want to select the which contain the field name 'Id' and the value '811'. What would be the xpath for this
So the correct xpath should return only
<node>
<field value="811" name="Id" />
</node>
Tried
/Result/node[field/@name='Id' and field/@value='811']
but this returns two nodes
如果要获取具有两个必需属性的field
node
,请尝试:
/Result/node[field[@name='Id' and @value='811']]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.