javarssrome

How would ROME find out if a custom module is used on a feed?


I'm currently using ROME for RSS processing of Podcast feeds. At the moment those feeds could be composed in different ways. (One of the exceptions is in an Itunes feed schema).

How does the custom feed reading work with Rome and the Modules package? Will ROME automatically convert the feed/entries object to the ITunes comptabable data object? Is there an example of this somewhere?


Solution

  • Yes, Rome will automatically provide you the metadata modules if you have rome-modules in your classpath:

    SyndFeed feed = ..
    for(SyndEntry entry : feed.getEntries()) {
        for (Module module : entry.getModules()) {
            System.out.println(module.getClass());
    
            if (module instanceof EntryInformation) {
                EntryInformation itunesEntry = (EntryInformation)module;
                ..
            }
        }
    }
    

    for a certain podcast feed, this will print out

    class com.rometools.rome.feed.module.DCModuleImpl
    class com.rometools.modules.content.ContentModuleImpl
    class com.rometools.modules.slash.SlashImpl
    class com.rometools.modules.itunes.EntryInformationImpl