Search code examples
javarssitunesrome

Parsing iTunes RSS using ROME for JAVA


I'm trying to parse a podcast rss feed that contains iTunes specific tags. ROME have a module for doing this which works just fine for getting the info for 'Channel' level tags.

ie. It gives you the meta info just fine. This is the code that does it:

SyndFeedInput input = new SyndFeedInput();
SyndFeed syndfeed = input.build(new XmlReader(feed.toURL()));

Module module = syndfeed.getModule("http://www.itunes.com/dtds/podcast 1.0.dtd");
FeedInformation feedInfo = (FeedInformation) module;

Now to parse the info for each individual episode of the podcast, there is an EntryInformation interface.

But where FeedInformation is created from casting the Module object, what do I use to populate EntryInformation?


Solution

  • EntryInformation is part of SyndEntry:

    for (SyndEntry entry : syndfeed.getEntries()) {
        Module entryModule = entry.getModule("http://www.itunes.com/dtds/podcast-1.0.dtd");
        EntryInformation entryInfo = (EntryInformation)entryModule;
        ..
    }