Formatting Title element in XML Feed with HTML tags

296 views Asked by At

I am using ASP.Net's inbuilt classes to create XML feeds for a website. Here's the code I have,

SyndicationFeed myFeed = new SyndicationFeed();
myFeed.Title = TextSyndicationContent.CreatePlaintextContent
("XYZ  - In the first line <br/> in the second line");

When rendered it shows as it is -

XYZ  - In the first line <br/> in the second line

whereas I want it

XYZ  - In the first line 
in the second line

I see that the behavior is only to myFeed.Title, whereas in myFeed.Description, I can use any HTML tags.

Any way to get HTML tags working with Titles?

1

There are 1 answers

3
JamieSee On

Use the SyndicationContent.CreateHtmlContent Method instead. SyndicationContent.CreatePlaintextContent always escapes the text to make it render literally.