Asad
Asad

Reputation: 21928

Reading content text from SyndicationContent

Hi i am trying to read the content into string from feed items.

SyndicationFeed feed = SyndicationFeed.Load(feedReader);    
SydicationContent itemContent = feed.Items.ToList<SyndicationItem>()[0].Content;
string retrivedContent = itemContent .......???

how can I read the text from the itemContent ?

The documentation shows how to create TextSyndicationContent

TextSyndicationContent textContent = new TextSyndicationContent("Some text content"); 

SyndicationItem item = new SyndicationItem("Item Title", textContent, new Uri("server/items";), "ItemID", DateTime.Now); 

Any way to reverse this ?

thanks

Upvotes: 8

Views: 4271

Answers (2)

Andrew Huey
Andrew Huey

Reputation: 852

TextSyndicationContent tsc = (TextSyndicationContent)item.Content;
string myContent = tsc.Text;

Upvotes: 26

Sani Huttunen
Sani Huttunen

Reputation: 24395

You could take a look at SyndicationFeed or at SyndicationContent.

Upvotes: -1

Related Questions