groovy get attribute from AndroidManifest.xml
<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.emnets.luoly.sample"
    android:versionCode="1"
    android:versionName="1.0" &gt;

&lt;uses-sdk
    android:minSdkVersion="24"
    android:targetSdkVersion="19" /&gt;

&lt;uses-permission android:name= "android.permission.WRITE_EXTERNAL_STORAGE" /&gt; 
&lt;uses-permission android:name= "android.permission.INTERNET" /&gt; 

&lt;application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" &gt;
    &lt;activity android:name="com.emnets.luoly.sample.MainActivity" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>I would like to get <code>uses-permission</code> using groovy.</p>

<p>Maybe like this,</p>

<pre><code>def manifestXml = new XmlParser().parse(Manifest)
 manifestXml."uses-permission".each { p -&gt;
            println p.attribute("android:name")
        }
</code></pre>

<p>How to get attribute like <code>android.permission.WRITE_EXTERNAL_STORAGE</code></p>