![]() Feed to the universal gofeed.Feed struct in the Default Mappings section. You can see how they translate fields from atom.Feed or rss.Feed json. The DefaultRSSTranslator, DefaultAtomTranslator, DefaultJSONTranslator are used behind the scenes when you use the gofeed.Parser with its default settings. The translation step is done by anything which adheres to the gofeed.Translator interface. Performing the universal feed parsing in these 3 stages allows for more flexibility and keeps the code base more maintainable by separating RSS, Atom and Json parsing into seperate packages. Finally, they are translated into a gofeed.Feed model that is a hybrid of all feed types. These models cover every field possible for their respective feed types. Then it uses a feed specific parser to parse the feed into its true representation which will be either a rss.Feed or atom.Feed or json. ![]() It first detects the feed type that it is currently parsing. The universal gofeed.Parser works in 3 stages: detection, parsing and translation. ![]() If you know ahead of time that you will only be parsing one feed type then it would make sense to use rss.Parser or atom.Parser or json. If you will be handling rss, atom and json feeds then it makes sense to use the gofeed. Which one you choose depends entirely on your usecase. The gofeed library is comprised of a universal feed parser and several feed specific parsers. Missing "required" elements as specified by the respective feed specs.Illegal tags within feed elements without namespace prefixes.Missing closing tags on certain elements.Unescaped/Naked Markup in feed elements.Currently, gofeed can successfully parse feeds with the following issues: Invalid FeedsĪ best-effort attempt is made at parsing broken and invalid XML feeds. It parses all other feed extensions in a generic way (see the Extensions section for more details). The gofeed library provides support for parsing several popular predefined extensions into ready-made structs, including Dublin Core and Apple’s iTunes. Feed, rss.Feed and json.Feed respectively. You also have the option of utilizing the feed specific atom.Parser or rss.Parser or json.Parser parsers which generate atom. The library provides a universal gofeed.Parser that will parse and convert all feed types into a hybrid gofeed.Feed model. ![]() The gofeed library is a robust feed parser that supports parsing both RSS, Atom and JSON feeds.
0 Comments
Leave a Reply. |