I have an XML file I’m trying to modify and want to add a new node to an existing config file. What I’m trying to do is use a multi line xml statement and add it to the XML file by using AppendChild.
Here is what I have so far and I’m getting an error:
[xml]$deliveryExtensionNode = @"<Extension Name=`"Database Delivery`">
<Configuration>
<Reports>
<Report>Sample Report</Report>
</Reports>
</Configuration>
</Extension>
"@
But I’m getting an error:
Unrecognized token in source text.
At C:\Users\Develer\AppData\Local\Temp\dc32aea8-9f74-4d4f-8237-6219a492ab7a.ps1:17 char:33
+ [xml]$deliveryExtensionNode = <<<< @”
I thought that Powershell can handle multi line assignments. I’m able to do the same with something like this:
$y = @"
This is a test.
This is another test
"@
Or is it because XML requires certain formatting?
@” needs to be on its own line so..