SyndicationItem将内容编码解析为摘要

时间:2016-04-16 22:45:16

标签: c# .net rss syndication-feed

我正在尝试将RSS提要项解析为SyndicationItem。

根据合同,Summary属性应包含RSS 2.0中的description元素。但我的RSS Feed包含元素内容编码,SyndicationItem的摘要包含内容编码而不是描述。我使用的RSS Feed是http://www.demorgen.be/nieuws/rss.xml

//
// Summary:
//     Gets or sets a summary of the item.
//
// Returns:
//     The atom:summary element or the description element in RSS 2.0.

如果存在内容编码,那么在description元素中获取文本的最佳方法是什么?

1 个答案:

答案 0 :(得分:0)

最终我必须从ElementExtensions

获取描述
string description;
foreach (var node in item.ElementExtensions)
{
    if (node.NodeName.Equals("summary"))
    {
        description = node .NodeValue;
        break;
    }
}