XML parsing is messy, especially parsing RSS and more specifically podcast feeds – a domain where specifications are mere recommendations. The swift-podcast-parser package composes a bidirectional parser for podcast feeds on top of swift-parsing aiming to find a solid balance between correctness and tolerance.
Apple podcast RSS feed requirements provide the framework for the rules in this parser. Although built for podcast feeds, swift-podcast-parser should be applicable to parse other types of RSS feeds.
With a PodcastParser
you can parse and print.
Parsing produces an XML structure from an input String.
try PodcastParser().parse(input)
Printing is the reverse operation of parsing in this context.
try PodcastParser().print(xml, into: &input)
Download some transient data, before running the tests.
$ ./Scripts/download_smoke_test_feeds.swift
Look at swift-xml-parser for general XML parsing by which this parser was initially inspired.