Powershell添加XmlElement
我有一个试图修改的XML文件,希望向现有配置文件添加一个新节点。我试图做的是使用一个多行xml语句,并使用AppendChild将其添加到xml文件中 以下是我到目前为止得到的信息,我得到了一个错误:Powershell添加XmlElement,powershell,Powershell,我有一个试图修改的XML文件,希望向现有配置文件添加一个新节点。我试图做的是使用一个多行xml语句,并使用AppendChild将其添加到xml文件中 以下是我到目前为止得到的信息,我得到了一个错误: [xml]$deliveryExtensionNode = @"<Extension Name=`"Database Delivery`"> <Configuration> <Re
[xml]$deliveryExtensionNode = @"<Extension Name=`"Database Delivery`">
<Configuration>
<Reports>
<Report>Sample Report</Report>
</Reports>
</Configuration>
</Extension>
"@
还是因为XML需要特定的格式?@“需要独立的行,所以
[xml]$deliveryExtensionNode = @"
<Extension Name=`"Database Delivery`">
<Configuration>
<Reports>
<Report>Sample Report</Report>
</Reports>
</Configuration>
</Extension>
"@
[xml]$deliveryExtensionNode=@”
样本报告
"@
你说得对,这是正确的。我确实有这个确切的语法。但是,我使用的是PowerGUI脚本编辑器,它对这个完全相同的语法感到奇怪。
[xml]$deliveryExtensionNode = @"
<Extension Name=`"Database Delivery`">
<Configuration>
<Reports>
<Report>Sample Report</Report>
</Reports>
</Configuration>
</Extension>
"@