Falco
Falco

Reputation: 1596

How to read xml attribute with colon in Powershell

Given an xml, something like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="SOMETHING.Presentation.Mobile.Droid" android:installLocation="auto" android:versionName="1.13.0" android:versionCode="15">
    <uses-sdk android:minSdkVersion="15" />
    <permission android:name=".permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <application android:label="SOME_NAME" android:largeHeap="true">
        <meta-data android:name="com.google.android.geo.API_KEY" android:value="SOMETHING" />
        <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="SOMETHING.Presentation.Mobile.Droid" />
            </intent-filter>
        </receiver>
    </application>
</manifest>

I'm trying to use a powershell script to rewrite it.

when I search for package like this:

$package = $xdoc.manifest.package

I get it "SOMETHING.Presentation.Mobile.Droid"

when I search for android:label (<application android:label="SOME_NAME" android:largeHeap="true">) I get nothing

I tried with non success:

How to point to attribute with "colon"?

Upvotes: 2

Views: 966

Answers (1)

Esperento57
Esperento57

Reputation: 17492

try this :

$xml.manifest.application.label

Upvotes: 3

Related Questions