SyndicationFeed: Content as CDATA?

前端 未结 9 2127
梦毁少年i
梦毁少年i 2021-01-13 16:17

I\'m using .NET\'s SyndicationFeed to create RSS and ATOM feeds. Unfortunately, I need HTML content in the description element (the Content property of the SyndicationItem)

9条回答
  •  梦毁少年i
    2021-01-13 16:35

    It might be too late but I leave my solution. I added it as a ElementExtension then it works for me. My environment is .NET 4.5.

    XNamespace nsDefault = "http://www.w3.org/2005/Atom";
    var content = new XElement(nsDefault + "content");
    content.Add(new XCData("Item Content"));
    item.ElementExtensions.Add(new SyndicationElementExtension(content));
    

提交回复
热议问题