我有一些代码可以将rss feed加载到我的WindowsPhone应用程序中:
var result = e.Result;
result = result.Replace("\t", string.Empty);
result = result.Replace("\n", string.Empty);
var rssItems = XDocument.Parse(result.Replace("dc:creator", "creator")).Descendants("item").Select(
x => new RssItem()
{
Title = (string)x.Element("title"),
Description = (string)x.Element("description"),
Link = (string)x.Element("link"),
Author = (string)x.Element("creator"),
Comments = (string)x.Element("comments"),
PubDate = ParseNewsDateToStringFormatExtended(Convert.ToDateTime((string)x.Element("pubDate"))),
ThumbnailPart = stripImagePathFromDescription((string)x.Element("description").Value.ToString()),
StrippedHtml = strippedHtmlConversion((string)x.Element("title"), (string)x.Element("creator"), ParseNewsDateToStringFormatExtended(Convert.ToDateTime((string)x.Element("pubDate"))), (string)x.Element("description").Value.ToString())
}
).ToList();
success(rssItems);
当它加载包含此符号«或»的Feed时,它会崩溃。如何让我的应用程序能够阅读这些符号?
编辑:这是我的RSS Feed中的一个元素:
<item>
<title>Norges «skjulte perle» utvider</title>
正如你可以看到项目标题中有一个«»。我知道这就是崩溃的原因。但为什么?以及如何处理这些符号?