Yarfraw provides a unified data model for all the feed formats that it supports. This means you can easily write a conversion utility to convert between different feed formats. Simply reads in the original format, and then write it to a file using a different format setting. For example, to convert a Rss 2.0 feed to Rss 1.0:
FeedReader r = new FeedReader("rss20.xml"); ChannelFeed c = r.readChannel(); File f = File.createTempFile("rss10", ".xml"); FeedWriter w = new FeedWriter(f); w.setFormat(FeedFormat.RSS10); w.writeChannel(c); //of course, you can read the converted feed r.setFormat(FeedFormat.RSS10); r.setFile(f); ChannelFeed c2 = r.readChannel();
There are a few things you need to be aware of:
The classes in the following three packages are generated by JAXB and are intended to be used internally by Yarfraw:
However, there's nothing stopping you from using them if you want to. You can use them to build the JAXB binding objects yourself and marshal them. Or you can use them to unmarshall an xml and deal with the binding object directly. To do that, use the following JAXB contexts:
CommonUtils.RSS20_JAXB_CONTEXT; CommonUtils.RSS10_JAXB_CONTEXT; CommonUtils.ATOM10_JAXB_CONTEXT; //and use them to get an unmarshaller Unmarshaller u = JAXBContext.newInstance(CommonUtils.RSS20_JAXB_CONTEXT).createUnmarshaller();
For more details, I encourage to take a look at the Javadoc . Also check out the FAQ section for more insights about this API.