nmdias / FeedKit

An RSS, Atom and JSON Feed parser written in Swift
MIT License
1.19k stars 174 forks source link

How to exted RSS feed with custom tags? #33

Closed NosovPavel closed 7 years ago

NosovPavel commented 7 years ago

I have specific tags in a feed adn I want to exted "RSSPath" enum and "RSSFeed + Attributes Mapper" according to my requirements. My tags aren't confirm to RSS 2.0 specifications. How I can do it easily without modifying source files? Is there any other ways?

nmdias commented 7 years ago

As it is, it's not possible.

FeedKit would have to be refactored handle the specifying of a Generic Type, conforming to a few default protocols to handle mapping of the current supported namespaces. And so that at the same time you could provide a subclass of that model and override whatever you need to.

This is of the top of my head, ...at a first glance, it seems like a nice addition. However, I must ask. Is this an existing service that you're integrating, or is it still in development? Because if it's in development, what is it exactly that you're trying extend? Have you looked at the current supported namespaces? Who knows, maybe they provide the capabilities that you're looking for. Or maybe there is a known namespace with those capabilities that we could add to FeeKit?

NosovPavel commented 7 years ago

Thanks for you answer! The service is really specific and it's in production :-( I think there is no necessity to add new attributes to FeedKit because it's a local thing. Now I know what should I do to apply FeedKit to my requirements.

nmdias commented 7 years ago

You're welcome, happy dev 🤠

funkenstrahlen commented 7 years ago

@nmdias Just to make sure I understand this discussion correctly: It is currently not possible to parse xml tags with FeedKit which are not already implemented in FeedKit? There is no way to extend it?

nmdias commented 7 years ago

Hi @funkenstrahlen,

Yes, that is correct. It is not possible to extend FeedKit beyond the supported namespaces, yet. It's tempting to add that feature, however.

If I may ask, are you looking to use a standard namespace, or are these private, custom elements and attributes?

Cheers

funkenstrahlen commented 7 years ago

I need to extend for private / custom elements. It is perfectly fine if you do not want to add this extendability because it takes a lot of architectural work and restructure of the code.

nmdias commented 7 years ago

If you happen to fork it to suit your needs and need help, do open an issue. I'll be glad to assist.

Just a note:

There's a bottleneck in FeedKit right now that becomes apparent when parsing a few hundred feeds. The fix, while not related, would actually make it easy to add that feature, because it involves moving the parsing into a dictionary, then out trough the Model.

Anyways, this is somewhat wishful thinking. I'll eventually add that, just don't know when.

Happy devs