FeedParser
Parses the bytes of one feed document into a Feed: the parser port of this module. RomeFeedParser is the supplied implementation on the JVM; a consumer supplies its own through FeedFetcherConfig.parser.
Experimental (implement). Implementing it needs @OptIn(ExperimentalForInheritanceWebToolsApi::class); calling it and passing one are Stable Core. An implementation must:
be thread-safe: parse is called from several threads at once, on the fetcher's
parseDispatcher, and never suspends;never throw for a bad document: return
Result.failurewith a FeedFailure leaf (a constant message, no cause, no document content). A failure that is not anHttpFailure, or an exception thrown out of parse, is reported by the fetcher asHttpFailure.DecodeFailure;refuse every DOCTYPE, in any encoding the document could be read in, before it reads further (
FeedFailure.Refused), and never resolve an external entity, DTD, include or schema location;honour every member of the FeedLimits the implementation was built with: exceeding
maxEntries,maxDepth,maxAttributesPerElement,maxElementsormaxNamespaceUrisfails withLimitExceeded; the text, id, link, category and enclosure limits truncate, fall back or drop;build every Feed, FeedEntry and FeedEnclosure through their factories, with absolute
http/httpslinks ornull, and a never-blank id;tell a web page, an empty body and a body that is not XML (
NotAFeed) from malformed XML (Malformed) where it can;treat a parse as non-cancellable and bound its own CPU: the fetcher cannot interrupt one.