1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| package RSS;
import java.net.URL;
import java.io.InputStreamReader;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
public class testRSS {
static void readRSS(String url){
try {
URL feedUrl = new URL(url);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
System.out.println(feedUrl);
}
catch (FeedException ex) {
ex.printStackTrace();
System.out.println("ERROR: "+ex.getMessage());
}
}
}
public class Execute {
public static void main(String[] args) throws UnknownHostException, IOException{ testRSS.readRSS("http://www.lemonde.fr/rss/sequence/0,2-3246,1-0,0.xml");
} |
Partager