0

当节点“name”等于“This is A”时,我试图根据下面的 XML 获取“state”的值:

<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()行不通的......我怎么能这样做?

4

1 回答 1

0

text()函数应与state使用斜线而不是句点分开:

//event[name="This is A"]/state/text()
于 2013-06-14T19:43:49.280 回答