Quantcast
Viewing all articles
Browse latest Browse all 10

Answer by WonderGrub for SyndicationFeed: Content as CDATA?

I had the same problem as some where the WriteContentsTo override wasn't being called in cpowers example (still no idea why). So, I changed it to inherit from the SyndicationContent class instead. Not sure if this is the best solution, but worked great in my situation.

public class CDataSyndicationContent : SyndicationContent{    public CDataSyndicationContent(string content)    {        Text = content;    }    public override SyndicationContent Clone()    {        return new CDataSyndicationContent(Text);    }    public override string Type    {        get { return "html"; }    }    public string Text { get; private set; }    protected override void WriteContentsTo(XmlWriter writer)    {        writer.WriteCData(Text);    }}

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>