Xpath 用命名空间选择同级属性的值 [英] Xpath to select value of sibling attribute with namespace
本文介绍了Xpath 用命名空间选择同级属性的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在努力定义一个 XPath 以从以下 XML 返回 uniqueappversionid
的值:
I'm struggling to get an XPath defined to return the value of the uniqueappversionid
from the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<manifest package="air.com.vzw.Foo"
android:versionCode="0"
android:versionName="0.0.0"
android:installLocation="auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="FooAIR">
<meta-data android:name="autoOrients" android:value="true" />
<meta-data android:name="fullScreen" android:value="false" />
<meta-data android:name="uniqueappversionid"
android:value="b1e1bfa8-20b4-4724-a9c3-34b79bc50b8d" />
<meta-data android:name="initialcontent" android:value="FooAIR.swf" />
</application>
</manifest>
更具体地说,我需要从带有 android:name
的 meta-data
元素中获取 android:value
属性的值等于 uniqueappversionid
.
More specifically, I need to get the value of the android:value
attribute from the meta-data
element with a android:name
equal to uniqueappversionid
.
推荐答案
With a
前缀绑定到 http://schemas.android.com/apk/res/android
命名空间:
With a
prefix bound to http://schemas.android.com/apk/res/android
namespace:
/manifest
/application
/meta-data[@a:name='uniqueappversionid']
/@a:value
这篇关于Xpath 用命名空间选择同级属性的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文