当节点“name”等于“This is A”时,我试图获取“state”的值,基于以下XML:
<xml>
<event>
<name>This is A</name>
<state>OK</state>
</event>
<event>
<name>This is B</name>
<state>KO</state>
</event>
</xml>
做//event[name="This is A"]/state.text()
这样的事情不起作用......我怎么能这样做?
答案 0 :(得分:0)
text()
函数应使用斜杠与state
分隔,而不是句点:
//event[name="This is A"]/state/text()