We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › refreshing an RSS feed (XML)
Page Index Toggle Pages: 1
refreshing an RSS feed (XML) (Read 367 times)
refreshing an RSS feed (XML)
May 27th, 2009, 7:40am
 
Hi all,

We're trying to populate an array with some stuff from an RSS feed continuously. Problem is that it all loads the first time but won't refresh after that -- it's as if there's a cache that won't clear. Any ideas? The RSS feed is stable and refreshes just fine from a browser or reader. Using XMLElement... Thanks for any advice!

Rebecca

void startfeed() {
 XMLElement rss = new XMLElement(this, url);
 XMLElement[] titleXMLElements = rss.getChildren("entry/title");  
 messages = new String[titleXMLElements.length];
 for (int i=0; i<titleXMLElements.length; i++) {
   String message = titleXMLElements[i].getContent();
   messages[i] = message;
 }
}


void updatefeed() {
 XMLElement rss = new XMLElement(this, url);
 XMLElement[] titleXMLElements = rss.getChildren("entry/title");  
 for (int i=0; i<titleXMLElements.length; i++) {
   String message = titleXMLElements[i].getContent();
   // CHECK IF WE ALREADY HAVE IT
   int foundit = 0;
   for (int j=messages.length-14; j<messages.length; j++) {
     String s1 = message.substring(0,10);
     String s2 = message.substring(0,10);    
     if (s1.equals(s2)) {
       foundit = 1;
     }
   }
   if (foundit == 0) {
     int l = messages.length;
     messages = expand(messages, l+1);
     messages[l] = message;
   }    
 }
}
Page Index Toggle Pages: 1