简体   繁体   English

SyndicationItem将内容编码解析为摘要

[英]SyndicationItem parses content-encoded into Summary

I am trying to parse an RSS feed item into SyndicationItem. 我试图将RSS提要项解析为SyndicationItem。

According to the contract, the Summary property should contain the description element from RSS 2.0. 根据合同,Summary属性应包含RSS 2.0中的description元素。 But my rss feed contains element content-encoded and the Summary of the SyndicationItem contains content-encoded instead of description. 但我的RSS Feed包含元素内容编码,SyndicationItem的摘要包含内容编码而不是描述。 The rss feed I am using is http://www.demorgen.be/nieuws/rss.xml 我使用的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.

If content-encoded exists, what is the best way to get the text in description element? 如果存在内容编码,那么在description元素中获取文本的最佳方法是什么?

Eventually I have to get the description from the ElementExtensions 最终我必须从ElementExtensions获取描述

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM