abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Graceful handling of non-atom 1.0 feeds
Date Sat, 10 Jun 2006 19:00:18 GMT
The parser will actually parse any arbitrary XML document.  Try the
parse without the generic, e.g.

Document doc = Parser.INSTANCE.parse(...)

doc.getRoot() will return an instance of ExtensionElement rather than
Feed.  This would be the right way of parsing in the case you're not
exactly sure what you're point at.  You can then do an instanceof to
determine if you ended up with the right thing.

The NPE sounds like a bug.  That shouldn't happen.

- James

Garrett Rooney wrote:
> In my experiements with pulling titles out of atom feeds last night, I
> inadvertently pointed my PrintTitles program at some atom 0.3 feeds.
> The results were, well, explosive.
> Now I'm not saying we should parse those feeds, we should really
> restrict oursives to atom 1.0, but it might be nice if we at least
> recognize them when we encounter them, so we can throw something more
> informative than a ClassCastException (the usual result) or
> NullPointerException (if you've got a ParseFilter set up).
> -garrett

View raw message