Following is the full code for a Java application that reads a syndication feed and converts it to other syndication feed type, writing the converted feed to the application's output.
下面的代码可以实现不同类型的订阅格式之间的类型转换
package com.sun.syndication.samples;import java.net.URL;
import java.io.InputStreamReader;import java.io.PrintWriter;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.SyndFeedOutput;
import com.sun.syndication.io.XmlReader;
String outputType = args[0];
URL feedUrl = new URL(args[1]);
SyndFeedInput input = new SyndFeedInput();
//creates a SyndFeedInput instance that will work with any syndication feed type (RSS and Atom versions).
SyndFeed feed = input.build(new XmlReader(feedUrl));
feed.setFeedType(outputType);
SyndFeedOutput output = new SyndFeedOutput();output.output(feed,new PrintWriter(System.out));




















