1
以下XML字符串去除特殊字符是PowerShell的代码,我使用从web.config文件中删除父节点:如何同时节约使用PowerShell
$c = "C:\test\web.config"
$xml = (Get-Content $c)
$ConnectionString = $xml.configuration.appSettings.add | Where-Object {$_.Key -eq 'ConnectionString'}
$xml.configuration.RemoveChild($ConnectionString.ParentNode)
$xml.save($c)
After removing <appSettings> tag from web.config file. Some special Characters like 
 are adding to web.config file as below:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
 System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
 PublicKeyToken=31bf3856ad364e35">
</configSections>
</configuration>
请让我知道如何保存XML文件无特殊字符,如

和新线
都[^ \ x00- \ XFF]和xml文件还是一样的特殊字符即 和 来了的白色,而不是UTF8编码空间 – Praveen 2015-04-01 10:38:26