I wrote a simple sample program which reads a given RSS feed and display some of the feed entries along with some attributes. It will also display the RSS version, as there are different versions of RSS. http://en.wikipedia.org/wiki/RSS_(file_format)
This simple program is the following:
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndImageImpl;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import com.sun.syndication.feed.synd.SyndContentImpl;
/*
* 2 Required Jar files
* rome-0.9.jar retrieved from http://rome.dev.java.net/
* jdom.jar retrieved from http://www.jdom.org/
*/
public class RSSReader
{
public static void iterateRSSFeed(String rssFeedUrl)
{
try
{
//open up a connection to the rss feed
URLConnection feedUrl = new URL(rssFeedUrl).openConnection();
//Create Feed Object
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
System.out.println("Examining rss feed:"+rssFeedUrl+"\n");
System.out.println("Feed type="+feed.getFeedType());
//Iterate through object to get details
List list = feed.getEntries();
System.out.println("Feed image="+feed.getImage());
if (feed.getImage()!=null)
{
SyndImageImpl image = (SyndImageImpl)feed.getImage();
String imageInfo = "Image url:"+image.getUrl()+"\n";
System.out.println(imageInfo);
}
for (int i=0 ; i < list.size(); i++){
//display entry attributes
SyndEntry entry = (SyndEntry)list.get(i);
String display = "Entry:"+i;
display += "\ntitle:"+entry.getTitle();
display += "\nlink:"+entry.getLink();
display += "\nauthor:"+entry.getAuthor();
display += "\npublished:"+entry.getPublishedDate();
display += "\nupdated:"+entry.getUpdatedDate();
display += "\ndescription:"+entry.getDescription();
display += "\ncontent size:"+entry.getContents().size();
if (entry.getContents().size()==1)
{
SyndContentImpl imp = (SyndContentImpl)entry.getContents().get(0);
display += "\ncontent value:"+imp.getValue();
}
display += "\n";
System.out.println(display);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
//James Gosling's blog
String rssFeedUrl = "http://blogs.sun.com/jag/feed/entries/rss";
//Mark Cuban's blog
//rssFeedUrl = "http://www.blogmaverick.com/rss.xml";
//rssFeedUrl = "http://techinitiatives.blogspot.com/feeds/posts/default";
//RSS 2.0
//rssFeedUrl = "http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c";
iterateRSSFeed(rssFeedUrl);
}
}
34 comments:
Thanks a lot friend,
Thats really interesiing and graet job done.
This helps my project a lot
if can plz send me a ebook related to this to sameira@gmail.com
thanks again ....
I am getting a connectionTimeOut at the below mentioned line for what ever URL I give..
SyndFeed feed = input.build(new XmlReader(feedUrl));
Any ideas as what is that I am doing wrong
Thnks a lot... God bless u
Great work ..! that really helps me
Hai you done great job.It is very useful for my application.one quires possible to read Google rss feeds....
emailId:prakashmsamy@gmail.com
Thanks a lot
Thanks so much!! This post is so clear and has saved me a lot of time - terrific!
[url=http://gallery.veafoorea.ru/big-breasted-russian-girls.html]big breasted russian girls[/url] [url=http://gallery.veafoorea.ru/absolute-russian-girls-models.html]absolute russian girls models[/url] [url=http://gallery.veafoorea.ru/free-pics-of-russian-mature-women.html]free pics of russian mature women[/url] [url=http://gallery.veafoorea.ru/mail-order-bride-tryouts.html]mail order bride tryouts[/url]
generates this error why?
Exception in thread “main” java.lang.NoClassDefFoundError: org/jdom/input/JDOMParseException
at com.sun.syndication.io.SyndFeedInput.(SyndFeedInput.java:58)
at com.sun.syndication.io.SyndFeedInput.(SyndFeedInput.java:48)
at feedrss.Main.main(Main.java:27)
Caused by: java.lang.ClassNotFoundException: org.jdom.input.JDOMParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
… 3 more
Java Result: 1
[url=http://song.hamee.ru/matchmaking-russian-women.html]matchmaking russian women[/url] [url=http://song.hamee.ru/mail-order-bride-from-camaroon.html]mail order bride from camaroon[/url]
you have a nice site. thanks for sharing this site. there are various kinds of ebooks are available here
http://feboook.blogspot.com
kayaking singles [url=http://loveepicentre.com/]cole hauser still dating his girlfriend[/url] free gay dating service http://loveepicentre.com/ dating polen
Hi everyone
We do not agree with this year BRITs 2010 decision.
Please attend our little survey
http://micropoll.com/t/KDqOnZBCWt
Lady Gaga can not be better than ?????
Poll supported by BRIT awards 2010 sponsor femmestyle
[url=http://www.femmestyle.li/brustvergroesserung/preis.html]brustvergrößerung preis[/url]
Do you have a burning question we could ask all the stars at The BRIT Awards?
Nice post and this fill someone in on helped me alot in my college assignement. Thanks you for your information.
sally temple albany medical college [url=http://usadrugstoretoday.com/products/isoptin.htm]isoptin[/url] stress timed language http://usadrugstoretoday.com/products/pepcid.htm should i kick out my 20 yr old drug using stealing son http://usadrugstoretoday.com/categories/perte-de-poids.htm
health women 40 [url=http://usadrugstoretoday.com/categories/hypnotherapie.htm]hypnotherapie[/url] dr atkins diet products [url=http://usadrugstoretoday.com/products/deltasone.htm]keflex dosage[/url]
http://rxonline.in/levodopa/stalevo-and-levodopa
[url=http://rxonline.in/lisinopril/find-lisinopril]acess to drugs in prison[/url] compare cialis viagra and levitra [url=http://rxonline.in/prostatitis/signs-and-symptoms-of-prostatitis]signs and symptoms of prostatitis[/url]
alpha adrerenergic drugs http://rxonline.in/propranolol/propranolol-ibuprofen
[url=http://rxonline.in/ziprasidone]pharmacy technition licence test examples[/url] winning drug testing rfp ca [url=http://rxonline.in/hydroxyurea/sickle-cell-anaemia-hydroxyurea]sickle cell anaemia hydroxyurea[/url]
drugs for psychological disorders http://rxonline.in/prometrium/prometrium-during-pregnancy
[url=http://rxonline.in/olanzapine/novo-olanzapine]levitra info levitra[/url] television commercials on drugs for diabetes [url=http://rxonline.in/zocor]zocor[/url] types or drugs and side effects [url=http://rxonline.in/orlistat/orlistat-adverse-diary]orlistat adverse diary[/url]
http://newrx.in/antabuse/quantite-minimale-alcool-antabuse
[url=http://newrx.in/erythromycin/how-does-erythromycin-kill-bacteria]simvistatin and erectile dysfunction[/url] generic statin drugs [url=http://newrx.in/anafranil]anafranil[/url]
erectile dysfunction treatments that work http://newrx.in/levaquin/aciphex-levaquin
[url=http://newrx.in/imuran/imuran-and-breastfeeding]drug given for narcotic addiction[/url] the drug known as shim [url=http://newrx.in/imitrex/imitrex-and-vicodine]imitrex and vicodine[/url]
california drug death 2008 http://newrx.in/disulfiram/disulfiram-cost-in-canada
[url=http://newrx.in/carbohydrate/protien-fat-carbohydrate-ratio-south-beach-diet]sav on pharmacy glenwood state boise[/url] common drugs [url=http://newrx.in/xanax/pharmacists-online-ordering-xanax]pharmacists online ordering xanax[/url] foods to help erectile dysfunction [url=http://newrx.in/restlessness/dyspnea-and-restlessness-in-dogs]dyspnea and restlessness in dogs[/url]
I have tried the example, at final i got the error that,
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:214)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:201)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:377)
at java.net.Socket.connect(Socket.java:530)
at java.net.Socket.connect(Socket.java:480)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:406)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:541)
at sun.net.www.http.HttpClient.(HttpClient.java:245)
at sun.net.www.http.HttpClient.New(HttpClient.java:318)
at sun.net.www.http.HttpClient.New(HttpClient.java:335)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:832)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:773)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:698)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1021)
at com.sun.syndication.io.XmlReader.(XmlReader.java:237)
at test.RssTest.iterateRSSFeed(RssTest.java:21)
at test.RssTest.main(RssTest.java:69)
Please advice.
Thanks in advance
Srinivas
air travel to africa http://livetravel.in/plane-tickets/cancelled-plane-tickets travel alarm clock ipod
[url=http://livetravel.in/expedia/hotel-motel-orlando-florida-airport-expedia]after hours travel service[/url] cheap intrenational student travel [url=http://livetravel.in/tourism/crtc-tourism-radio]crtc tourism radio[/url]
cheap rooms for travel agents http://livetravel.in/airline/how-to-become-an-airline-attendant
[url=http://livetravel.in/tour/tour-company-in-malaysia]europe travel group[/url] gifts for travel lover [url=http://livetravel.in/map/map-sewells-point]map sewells point[/url]
off duty travel http://livetravel.in/expedia/do-i-have-a-contract-with-expedia
[url=http://livetravel.in/maps/county-maps-nc]travel agent forms[/url] cheap travel from south africa [url=http://livetravel.in/travel/airstrem-travel-tralers]airstrem travel tralers[/url] tucsany travel [url=http://livetravel.in/car-rental/car-rental-mustang-gt-return-at-different-location]car rental mustang gt return at different location[/url]
hajj travel agents [url=http://livetravel.in/plane-tickets/pittsburgh-plane-tickets]pittsburgh plane tickets[/url]
travel clinic locations toronto http://livetravel.in/disneyland/kaiser-alumonum-in-disneyland
[url=http://livetravel.in/tours/buenos-aires-sex-tours]la state travel[/url] travel guitar comparising [url=http://livetravel.in/car-rental/stansted-car-rental]stansted car rental[/url]
[url=http://livetravel.in/maps/fort-bragg-east-maps]fort bragg east maps[/url] goodhope travel bag 7271 [url=http://livetravel.in/airline/how-to-become-an-airline-attendant]how to become an airline attendant[/url] point to point travel times in new york city [url=http://livetravel.in/airport/airport-tower-audio]airport tower audio[/url]
travel agencys manila [url=http://livetravel.in/map/alcas-lorraine-france-map]alcas lorraine france map[/url]
wide fitting shoes http://topcitystyle.com/women-page18.html inexpensive shoes wedding [url=http://topcitystyle.com/?action=products&product_id=1042]nike air basketball shoes[/url] interior designers outlet
http://topcitystyle.com/red-on-sale-color8.html designer diaper bag [url=http://topcitystyle.com/b-rich-on-sale-brand72.html]who invented the clothes dryer[/url]
joven ninas xxx http://xwe.in/ass-video/ass-videos-free
[url=http://xwe.in/adult-xxx/sydney-adult-chat]adult yorkies[/url] servings a day of vegtables for an adult [url=http://xwe.in/shemales/wellhung-shemales]wellhung shemales[/url]
anal video tgp http://xwe.in/thongs/coed-thongs
[url=http://xwe.in/erotic-video/erotic-romantic-wife-stories-with-pictures]uberlube lubricant[/url] amateur youngest couple porn [url=http://xwe.in/erotic-gay/erotic-suspension-movies]erotic suspension movies[/url]
virgin vlue http://xwe.in/bondage/beginners-bondage-set
[url=http://xwe.in/teen-ass/women-with-nice-ass]amateur men naked nude cock dick personals[/url] adult birthday parties in georgia [url=http://xwe.in/ass-video/dirty-sluts-take-it-hard-up-the-ass]dirty sluts take it hard up the ass[/url]
allison angel anal http://xwe.in/erotic-stories/stockings-suspenders-bisexaul-erotic-stories
[url=http://xwe.in/archive-adult/adult-baby-galleries]adult children of alcoholics groups in wv[/url] adult hermione granger [url=http://xwe.in/nylon/pvc-nylon-diaper-bags]pvc nylon diaper bags[/url]
baltimore smoking ban [url=http://usadrugstoretoday.com/index.php?lng=en&cv=us]Buy generic and brand medications[/url] diflucan cod http://usadrugstoretoday.com/catalogue/l.htm
depression january 21st [url=http://usadrugstoretoday.com/products/alavert.htm]alavert[/url] great depression interviews [url=http://usadrugstoretoday.com/categories/anti-allergico---asma.htm ]free weight loss support [/url] penis into vagna
fight hi blood preasure [url=http://usadrugstoretoday.com/products/dulcolax.htm]dulcolax[/url] medical suffixes http://usadrugstoretoday.com/categories/de-la-salud-de-la-mujer.htm
anxiety effects [url=http://usadrugstoretoday.com/products/kytril.htm]kytril[/url] dopamine drug comparison graph [url=http://usadrugstoretoday.com/products/fincar.htm ]breast siizes [/url] symptoms kidney infection
replica designer handbags http://luxefashion.us/on-sale-evening-cocktail-type2.html vibrating therapuedic shoes [url=http://luxefashion.us/roberto-cavalli-button-down-tops-shirts-brand7.html]ice slip on shoes springs[/url] love my shoes
http://luxefashion.us/armani-women-s-tops-brand8.html naked girls trying taking off each others clothes [url=http://luxefashion.us/?action=products&product_id=2439]sour shoes[/url]
best new web designers for business sites http://www.thefashionhouse.us/42-versace-size23.html hi tech squash shoes [url=http://www.thefashionhouse.us/t-shirts-for-men-page13.html]old fashioned beef stew[/url] tubbs snowshoes
http://www.thefashionhouse.us/black-blue-men-underwear-color91.html lifestride shoes [url=http://www.thefashionhouse.us/roberto-cavalli-jackets-amp-sweatshirts-brand7.html]girls removing clothes[/url]
brady movie [url=http://moviestrawberry.com/films/film_300/]300[/url] movie 1970s fantastic voyage http://moviestrawberry.com/films/film_pete_s_dragon/ cinamark movie theaters greeley colorado
free share wife movie [url=http://moviestrawberry.com/films/film_perfect_opposites/]perfect opposites[/url] crash movie review http://moviestrawberry.com/films/film_are_we_done_yet/ movie gay conversion camp
incredible hulk movie actress [url=http://moviestrawberry.com/films/film_pokemon_4ever/]pokemon 4ever[/url] violent movie images
movie start named after sc river [url=http://moviestrawberry.com/films/film_superman_batman_public_enemies/]superman batman public enemies[/url] arctic movie http://moviestrawberry.com/films/film_clash_of_the_gods/ jodi foster movie
movie theaters in nh [url=http://moviestrawberry.com/films/film_lone_rider/]lone rider[/url] french movie ratings http://moviestrawberry.com/films/film_repo_the_genetic_opera/ double jeopardy movie
movie little children [url=http://moviestrawberry.com/films/film_loverboy_70/]loverboy 70[/url] freedom to fascism movie http://moviestrawberry.com/films/film_repli_kate/ sandra mccoy lesbain movie scenes
free on line streaming facing the giants movie [url=http://moviestrawberry.com/films/film_warriors_of_terra/]warriors of terra[/url] cum face movie post http://moviestrawberry.com/films/film_mission_impossible/ tommy lee jones and susan sarandan new movie
tmnt movie [url=http://moviestrawberry.com/films/film_the_other_sister/]the other sister[/url] movie never cry wolf
xxx movie free fulllength download [url=http://moviestrawberry.com/films/film_the_art_of_war/]the art of war[/url] bi sexual movie downloads http://moviestrawberry.com/films/film_street_fighter_alpha_generations/ sydney white movie listings
top movie may 1995 [url=http://moviestrawberry.com/films/film_up_in_smoke/]up in smoke[/url] radio flyer movie abuse http://moviestrawberry.com/films/film_lifes_decisions/ nude classic movie stars
[url=http://loans.legitpaydayloansonline1.com/]Payday loans online[/url] Stype Payday loans online Flallododebag http://loans.legitpaydayloansonline1.com Fundpopog The applicant is absolutely free from back factor from the borrower's point of view?Well, depending on the situation, payday loans can arise a paydayloan until payday comes by.
Specially to highlight that Buy Cialis Online dysfunction drug
is not recommended for community of people who are consuming nitroglycerin ' in any form or alpha-blockers by way of vaccines or capsules, as this combination may cause drip in blood pressure rate and may lead to an insecure applications. Include a dry bed area for the turtles to crawl out of the water and bask under the UV lights. Although it is not so easy today also, with right marketing strategies, it can be achieved in a comparatively shorter span of time.
Feel free to visit my weblog; effects of cialis and grapefruit
It's useful for [url=http://ywashst.com]order lifecell[/url] with the label, not the packaging. lifecell Due to repetitive expand and pressure movement, your skin seems to lose manages to lose http://lfcream.com Good For Wrinkles
Hi, its fastidious piece of writing about media print, we all understand media is a
enormous source of facts.
Here is my homepage クリスチャンルブタン
Thanks in support of sharing such a nice thought, piece
of writing is pleasant, thats why i have read it fully
Feel free to visit my site ... クロエ 財布
Please let me know if you're looking for a author for your weblog. You have some really good articles and I feel I would be a good asset. If you ever want to take some of the load off, I'd really like to write some content for your blog in exchange for a link back to mine.
Please shoot me an email if interested. Cheers!
Also visit my blog post ... ミュウミュウ靴
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/input/JDOMParseException
at com.sun.syndication.io.SyndFeedInput.(SyndFeedInput.java:57)
at com.sun.syndication.io.SyndFeedInput.(SyndFeedInput.java:47)
i have added jdom 2.0.5 version..
balenciaga shoes
jordan shoes
kate spade handbags
cheap jordans
golden goose
coach outlet online
nike x off white
cheap jordans
balenciaga shoes
golden goose sneakers
Post a Comment