XML : Reading a Custom Element from an RSS feed with SyndicationFeed in C#

I'm trying to read from several RSS feeds, my code works for the first feed but not all the other ones. I have my code set up like this

   XmlReader FD_readxml = XmlReader.Create(OfferAPIURL);   SyndicationFeed FD_feed = SyndicationFeed.Load(FD_readxml);    foreach (SyndicationItem FD_item in FD_feed.Items)    switch (offerCase) {      case 1:  firstOffer.Text = (FD_item.Title.Text);      break;      case2: secondOffer.Text = (FD_item.Title.Text);      break;  }    

and that works fine until another RSS feed gets passed. The problem is the first RSS feed (the one that works) has the feed Split by Item Elements. So I can use SyndicationItem.

  <item>              <title></title>              <link></link>              <description></description>  </item>    

The feed I can't read is set up like

  <offer>              <title></title>              <link></link>              <description></description>  </offer>    

So using SyndicationItem.Title, or SyndicationItem.Summary, just returns blank, since its not an item element, its a Offer.

So my question is can I read the custom element tag, so I can get the tittle, description and link for the offer tag.

Create my own Syndication like

  SyndicationOffer FD_offer in FD_feed.offers    

No comments:

Post a Comment