On Thu, Nov 13, 2008 at 11:22 AM, Bruce Snyder <[EMAIL PROTECTED]> wrote: > On Thu, Nov 13, 2008 at 3:44 AM, James Abley <[EMAIL PROTECTED]> wrote: > >> You're pulling down Atom feeds that have an html DOCTYPE? Are you sure >> that they're valid Atom feeds? What does the feedvalidator [1] say? >> >> Cheers, >> >> James >> >> [1] http://www.feedvalidator.org/ > > Thanks, James. Your suggestion made me realize that the URL was > incorrect. Now I have the correct Atom URL and I'm getting an error in > the processing. Please see the code block and error below: > > for (int i = 0; i < uris.length; ++i) { > String uri = (String) uris[i]; > ClientResponse resp = client.get(uri); > if (resp.getType() == ResponseType.SUCCESS) { > Document<Feed> doc = resp.getDocument(); > Feed feed = doc.getRoot(); // error occurs here > LOG.info(feed.getTitle()); > > for (Entry entry : feed.getEntries()) { > LOG.info("\t" + entry.getTitle()); > } > } else { > System.out.println("Failure"); > } > } > > > Exception in thread "main" java.lang.ClassCastException: > org.apache.abdera.parser.stax.FOMExtensibleElement > at com.sonatype.feedeater.FeedEater.grabUris(FeedEater.java:53) > at com.sonatype.feedeater.FeedEater.run(FeedEater.java:41) > at com.sonatype.feedeater.FeedEater.main(FeedEater.java:34) > > > This could very well be due to my lack of knowledge of Abdera and Atom > feeds in general. Any suggestions are appreciated.
Does the document actually have a <feed> element at it's root? That's the kind of error you'd get if you parsed (for example) an Atom <entry> instead of an Atom <feed>. -garrett