abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Rooney" <roo...@electricjellyfish.net>
Subject Re: Graceful handling of non-atom 1.0 feeds
Date Sun, 11 Jun 2006 16:25:12 GMT
On 6/11/06, James M Snell <jasnell@gmail.com> wrote:
> The generics are an API optimization.  The code autodetects what is
> being parsed. In every case, Document.getRoot() returns some derivative
> of the FOM Element interface.  If you know what you're parsing, use the
> generics; if you're not sure what you're parsing, don't use the generics
> and do an instanceof to see what you ended up with.  I'm not sure I see
> the "problem".

Ok, that makes sense.  Sounds like the kind of thing we should be able
to solve with some useful documentation on best practices for using
the APIs.

> Alternatively, plug in an Atom 0.3 Extension Factory and provide a set
> of classes that implement the FOM on top of the Atom 0.3 model.  Then
> you could continue to use the generics form.  By Tuesday I should be
> able to post some sample code that illustrates this...
>
>   Document<Feed> doc = Parser.INSTANCE.parse(atom03FeedStream);
>   Feed feed = doc.getRoot();
>   System.out.println(feed.getClass());   // outputs sample.Atom03Feed

Neat!

-garrett

Mime
View raw message