Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

xml - Xpath to select value of sibling attribute with namespace

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>

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With a prefix bound to http://schemas.android.com/apk/res/android namespace:

/manifest
   /application
      /meta-data[@a:name='uniqueappversionid']
         /@a:value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...