ahorn / android-rss

Lightweight Android library to parse RSS 2.0 feeds.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add possibility to add new tags

k-misztal opened this issue · comments

Add some kind of API that allows devs to add support for new tags. It can by adding setters to RSSHandler. I have to handle RSS feed where instead of pubDate there is dc:date, and there is no possibility to use that library.

commented

A perhaps down-to-earth design could be to add another RSSHandler constructor that takes as input other setters in the hash-map. Of course, the problem with such a design is that it does not address the need of having to generate the appropriate getters and setters in RSSFeed or RSSBase. This is a sort of strong coupling that would be cumbersome to maintain over time, and it is not the kind of flexible extension system you may have in mind.

A better design would probably use annotations in the style of JAX-RS. But that is a significant redesign for which, I am afraid, I may not be able to find the cycles right now.

I can see the problem now. I didn't go into your code a lot, but what with playing with generics? Something like:

class RSSHandler<T extends RSSBase> {

  private T item;
  
  public RSSHandler(Map<String, Setter<T> customSetters) {
    ...
  }

  interface Setter<F extends RSSBase> {
    void set(F item, Object data)
  }
  
}

Like this you can change what exact implementation of RSSBase is stored inside of handler.

commented

Hi @k-misztal

For some time now, I wanted to update the README with references to projects/products that are using android-rss. If you are willing to share any of this information, I would be grateful if you could respond with the project name or product that is using android-rss.

Many thanks in advance.

In the end I've used Simple XML - I had to support few extra tags, especially that I fetched data from both RSS1.0 and RSS2.0. But it was nothing fancy, really simple project.