2

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?

Tom O'Brien
  • 1,741
  • 9
  • 45
  • 73

1 Answers1

1

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;
    ..
}
janih
  • 2,214
  • 2
  • 18
  • 24
  • That gives an error, since it does not allow to convert from type Object to SyndEntry in the for loop – Tom O'Brien Jul 13 '15 at 14:42
  • I got it working by doing an old fashioned for loop and doing a cast of each entry from the .getEntries() method to a (SyndEntry) object. Works now... Thanks. – Tom O'Brien Jul 13 '15 at 14:53
  • Good. You are probably using an old version of Rome library (without generics) if the getEntries method returns Objects. The newest release is 1.5.0: http://mvnrepository.com/artifact/com.rometools/rome/1.5.0 – janih Jul 13 '15 at 14:57