Posts

Showing posts with the label rss

Java - Parsing Google News RSS Not Working

Java - Parsing Google News RSS Not Working I am trying to parse this simple google RSS feed using java. My goal is to get all the titles of the news articles. My code below, however, does not do this. I would really appreciate your help, thanks. Parsing Method: public static String readLink(String urlAdress) throws IOException { int i = 0; URL rssUrl = null; try { rssUrl = new URL(urlAdress); } catch (MalformedURLException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(rssUrl.openStream())); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String articleTitles = ""; String line = in.readLine(); while (line != null) { i ++; System.out.println("Line is not null"); if (line.contains("<title>")) { S...