我正在使用.NET的SyndicationFeed来创建RSS和ATOM提要.不幸的是,我需要在描述元素(SyndicationItem的Content属性)中使用HTML内容,格式化程序会自动对HTML进行编码,但我宁愿将整个描述元素包装在CDATA中,而不对HTML进行编码.
我的(简单)代码:
var feed = new SyndicationFeed("Title", "Description",
new Uri("http://someuri.com"));
var items = new List<SyndicationItem>();
var item = new SyndicationItem("Item Title", (string)null,
new Uri("http://someitemuri.com"));
item.Content = SyndicationContent.CreateHtmlContent("<b>Item Content</b>");
items.Add(item);
feed.Items = items;
Run Code Online (Sandbox Code Playgroud)
有人知道如何使用SyndicationFeed做到这一点吗?我的最后一招是"手动"为feed创建XML,但我宁愿使用内置的SyndicationFeed.