xpath表达式:根据其他元素查找元素的值
如果标题的值是“这是一个标题”,我想找到演示者的值
<AXFRoot>
<MAObject type="default" mdclass="PROGRAM">
<GUID dmname="">ID00001</GUID>
</MAObject>
<MVAttribute type="RUNDOWN" index="0" attribute="RUNDOWN" mdclass="PROGRAM" objectid="ID00001">
<Meta name="TITLE" format="string">This is a title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">abcdef</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
<MVAttribute type="RUNDOWN" index="1" attribute="RUNDOWN" mdclass="PROGRAM" objectid="ID00001">
<Meta name="TITLE" format="string">This is another title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">ghijkl</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
</AXFRoot>
到目前为止我得到了,
//AXFRoot/MVAttribute[@type='RUNDOWN']/Meta[@name='TITLE' and text()='This is a title']
但这只给了我标题元素,而不是演示者的值。我需要添加什么?
I want to find the value of the presenter if the value of the title is 'This is a title'
<AXFRoot>
<MAObject type="default" mdclass="PROGRAM">
<GUID dmname="">ID00001</GUID>
</MAObject>
<MVAttribute type="RUNDOWN" index="0" attribute="RUNDOWN" mdclass="PROGRAM" objectid="ID00001">
<Meta name="TITLE" format="string">This is a title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">abcdef</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
<MVAttribute type="RUNDOWN" index="1" attribute="RUNDOWN" mdclass="PROGRAM" objectid="ID00001">
<Meta name="TITLE" format="string">This is another title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">ghijkl</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
</AXFRoot>
So far I got
//AXFRoot/MVAttribute[@type='RUNDOWN']/Meta[@name='TITLE' and text()='This is a title']
but this only gives me the title element, not the value of the presenter. What do I need to add?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你就快到了:
或者
You were almost there:
or