Vũ Nguyễn
Vũ Nguyễn

Reputation: 198

How to put colon character into xml property powershell, using SetAttribute

How do I put a colon character into an XML property Powershell, using SetAttribute? Something like this:

android:hardwareAccelerated = true

Upvotes: 1

Views: 839

Answers (1)

dan-gph
dan-gph

Reputation: 16909

You pass the URI for the namespace that corresponds to the "android:" prefix.

If your XML looked like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.package.name"
      android:versionCode="2"
      android:versionName="1.1">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
    </application>
</manifest>

(You really should have provided the XML in your question, by the way, instead of making us look it up.)

Note the xmlns:android="http://schemas.android.com/apk/res/android".

Then you can set the attribute by passing that URI:

$myXml.manifest.application.SetAttribute(
    'hardwareAccelerated', 
    'http://schemas.android.com/apk/res/android', 
    'true')

Upvotes: 4

Related Questions