首页 文章

SyndicationItem将内容编码解析为摘要

提问于
浏览
1

我试图将RSS提要项解析为SyndicationItem .

根据 Contract ,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

    最终我必须从ElementExtensions获取描述

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

相关问题