Clean up unescaped & in feed XML

This commit is contained in:
2014-09-16 09:43:32 -04:00
parent 7d5f6b2779
commit ef61ce278c
2 changed files with 15 additions and 6 deletions

View File

@@ -17,10 +17,14 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<IsWebBootstrapper>false</IsWebBootstrapper>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<PublishUrl>\\server\d\FeedCenter\</PublishUrl>
<Install>true</Install>
<InstallFrom>Unc</InstallFrom>
@@ -54,7 +58,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>

View File

@@ -1,4 +1,5 @@
using Common.Debug;
using System.Text.RegularExpressions;
using Common.Debug;
using Common.Xml;
using FeedCenter.FeedParsers;
using System;
@@ -172,6 +173,10 @@ namespace FeedCenter
// Clean up common invalid XML characters
feedText = feedText.Replace("&nbsp;", "&#160;");
// Find ampersands that aren't properly escaped and replace them with escaped versions
var r = new Regex("&(?!(?:[a-z]+|#[0-9]+|#x[0-9a-f]+);)");
feedText = r.Replace(feedText, "&amp;");
return Tuple.Create(FeedReadResult.Success, feedText);
}
catch (IOException ioException)