Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

XML - Change node value selected by attribute. Is it possible?

$
0
0

I got a xml file with this content:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <applicationSettings>
    <MyApp>
      <setting name="Button1" serializeAs="String">
        <value>test</value>
      </setting>
      <setting name="Button2" serializeAs="String">
        <value>test</value>
      </setting>
      <setting name="Button3" serializeAs="String">
        <value>test</value>
      </setting>
 </MyApp>
  </applicationSettings>
</configuration>

The attribute 'name' has several values down the file. This sample just showing three values (Button1 - 3)

How do I change <value>test</value> to <value>tested</value> only where attribute name="Button2" ?

It has to be accurate because the next time it might be down the file where attribute name="Button133"

Is there anyone that can help me with this Powershell question?

Thanks!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>