Search code examples
c#.netrsssyndication-feed

SyndicationItem parses content-encoded into Summary


I am trying to parse an RSS feed item into SyndicationItem.

According to the contract, the Summary property should contain the description element from RSS 2.0. But my rss feed contains element content-encoded and the Summary of the SyndicationItem contains content-encoded instead of description. The rss feed I am using is 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?


Solution

  • Eventually I have to get the description from the ElementExtensions

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