Question: trying to replace a node with a word that doesnt match with the other nodes. not supposed to the know the word in replacing. very

trying to replace a node with a word that doesnt match with the other nodes. not supposed to the know the word in replacing. very close but need help. its powershell

Copy-Item d:\animals.xml -Destination D:\\pig.xml

[xml]$XML = [System.Xml.XmlDocument](Get-Content (Resolve-Path"D:\pig.xml"))

Foreach($Value in Select-Xml $XML -XPath '//Description'| %{$_.Node.'#text'})

{

If($Value -match 'Corn')

{

continue

}

else

{

$Value -replace '\w+ (\w+)' , 'corn'

}

}

Output= System.Xml.XmlDocument

i need help and i would love for the code advice to be similar to what i have. thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!