• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

feed .rss/.rdf files from a random news web-site

Hi all,
   How do I feed a .rss or .rdf file from a random news web-site, so that I can get the headlines and description for the headlines in my java application?

Any help would be helpful,
Thanks,
mrpatel
0
mrpatel
Asked:
mrpatel
  • 2
1 Solution
 
bobbit31Commented:
i don't know what an .rss or .rdf file is, but i know you can use a URLConnection to read a file from a webserver.

ie (untested code):

BufferedReader in = null;

try {
    URL myURL = new URL("http://www.someserver.com/blah.rss");
    URLConnection conn = myURL.openConnection();
   
    in = new BufferedReader (new InputStreamReader(conn.getInputStream());

    String s;
    String myFile = "";

    while ((s = in.readLine()) != null) {
         myFile += s;
    }

    System.out.println(myFile);
    in.close();
} catch (Exception e) {
    e.printStackTrace();
}
0
 
CleanupPingCommented:
mrpatel:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
bobbit31Commented:
recommendation: points to bobbit31
0
 
tomboshellCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept bobbit31's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thomas Boshell
EE Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now