Scraping data from html site, issue with variable storing last String
<p>I have some code that is grabbing the latest headline from a website and storing it in a String called newhead.  Then a second String variable named oldhead is set to the same value as newhead so that on the next iteration (every 60 seconds) if the newhead=oldhead then we have no new info on the webpage and thus nothing is printed.  However, if newhead does not equal oldhead then we have a new headline and it is printed out.</p>

<p>Below is my code:</p>

<pre><code>String newhead = doc.select("item").select("title").first().text();             

Date date = new Date();
System.out.println( "  " + newhead + "....");
System.out.println("      "+"[" + date.toString() + "]" + "   [" + "TEST WEBPAGE"+"]");
System.out.println();   

if(newhead.equals(oldhead)){
   // DO NADA REPEAT HEADLINE
} else {
   if (kw.symbolCheck(newhead)) {
      String url ="http://www.marketwire.com/rss/BreakingNewsReleasesEnglish.xml";
      distObject.distribute(newhead, url, serv);
      oldhead=newhead;
   } else {
      oldhead=newhead;
   }
}
} catch(IOException e){}
}}
</code></pre>

<p>This is working for every site I am scraping (100+) except now that I am adding RSS feeds, and XML pages it is printing out repeats and I cant figure out why this is happening.  </p>
