locked
how do i determine that rss is updated? RRS feed

  • Question

  • How can i determine that rss is updated from the last time when i read that?

    Please help


    Regards Kumar Gaurav.
    Tuesday, November 22, 2011 7:18 PM

Answers

  • You need to get the RSS xml file and check the lastBuildDate element as specified here.  There is no way to check it before getting the xml though, in most cases.
     

    --
    Mike
    • Proposed as answer by Link.fr Tuesday, November 22, 2011 9:49 PM
    • Marked as answer by urprob Wednesday, November 23, 2011 4:08 PM
    Tuesday, November 22, 2011 7:43 PM
  • Hi urprob,

    I think Mike hits the nail on the head.

    But we should notice that the lastBuildDate element is optional, so some RSS feed may not contain this element, this is one situation.
    Here I want to add another infrequent but possible situation: The lastBuildDate element should be automatically updated in code when saving the RSS file after updating in an impeccable RSS editing/updating system, but the update procedure is performed manually by some small RSS Feed providers, they may forget to update the lastBuildDate element after updating.
    For these two situations we should compare the old content with the new content to decide if it has been updated, thus, save the content of the RSS content everytime you close the RSS reader, the next time you open your RSS reader, you can check out.
                var oldRSS = new XmlDocument();
                oldRSS.Load(@"C:\OldRSSContent.xml");
    
                var liveRSS = new XmlDocument();
                liveRSS.Load("http://.../rss.xml");
    
                if (oldRSS.InnerXml != liveRSS.InnerXml)
                    MessageBox.Show("The RSS feed has been updated since the last time");
    

    Have a nice day,
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, November 23, 2011 7:46 AM

All replies

  • You need to get the RSS xml file and check the lastBuildDate element as specified here.  There is no way to check it before getting the xml though, in most cases.
     

    --
    Mike
    • Proposed as answer by Link.fr Tuesday, November 22, 2011 9:49 PM
    • Marked as answer by urprob Wednesday, November 23, 2011 4:08 PM
    Tuesday, November 22, 2011 7:43 PM
  • Hi urprob,

    I think Mike hits the nail on the head.

    But we should notice that the lastBuildDate element is optional, so some RSS feed may not contain this element, this is one situation.
    Here I want to add another infrequent but possible situation: The lastBuildDate element should be automatically updated in code when saving the RSS file after updating in an impeccable RSS editing/updating system, but the update procedure is performed manually by some small RSS Feed providers, they may forget to update the lastBuildDate element after updating.
    For these two situations we should compare the old content with the new content to decide if it has been updated, thus, save the content of the RSS content everytime you close the RSS reader, the next time you open your RSS reader, you can check out.
                var oldRSS = new XmlDocument();
                oldRSS.Load(@"C:\OldRSSContent.xml");
    
                var liveRSS = new XmlDocument();
                liveRSS.Load("http://.../rss.xml");
    
                if (oldRSS.InnerXml != liveRSS.InnerXml)
                    MessageBox.Show("The RSS feed has been updated since the last time");
    

    Have a nice day,
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, November 23, 2011 7:46 AM
  • okay, that means i have to read complete rss file all the time,  okay. BUt let's say the file changed and i have to add updated or new item into list then do i need to repopulate the list or is there any method to get the changes made in rss.

    In dataset i saw a method, dataset.GetChanges(). i belive it gives the changes done from previously read rss but don't know how to use it, right now i'm using  xmlDocument for reading rss.

    Wednesday, November 23, 2011 11:31 AM
  • I have never used an instance of DataSet to load an RSS feed, I even objected to this, please check out one of my prior threads:
    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ca567f0c-9ae4-4ff1-9187-9502e3927f8e.

    But now I find some blogs/articles about this, maybe you can investigate into this and share your achievements. :)
    Here are some references:
    http://channel9.msdn.com/coding4fun/articles/A-Simple-RSS-Feed.
    http://idunno.org/archive/2005/06/24/207.aspx.
    -------------------------------------------------
    This response contains links reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Happy coding & working,


    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, November 23, 2011 11:48 AM
  • The "guid" element of each "item" element should be unique in the channel.  This element contains string values, not true guids in the .net sense, so be aware of this. 
     
    If the guid is not found in your previously found items, then the item is new to you.

    --
    Mike
    Thursday, November 24, 2011 12:09 AM