Parse an RSS 2.0 document into its channel metadata and raw items. Throws on a
document whose document element is not <rss> (an XML error envelope, an Atom feed,
a JSON body), on an <item> anywhere but directly inside the first <channel> (items
wrapped in <items>, or in a second channel: they would be dropped unread), on one
with no <channel> directly inside it (e.g. the portal's HTML
shell or an empty body —
the engine turns those into a typed LebensmittelwarnungParseError first, but
this is a defensive backstop), and on an unterminated element, comment, CDATA
section, processing instruction, declaration or tag (a truncated or hostile body).
A single forward scan (indexOf for every terminator), so parsing time is linear
in the size of the body, whatever it contains. Only the direct children of the
first <channel> and of its <item>s are read; a leaf's text is its decoded text
plus its CDATA sections verbatim, and markup inside a leaf is kept as written.
Element names match case-insensitively. The first occurrence of a leaf wins.
Parse an RSS 2.0 document into its channel metadata and raw items. Throws on a document whose document element is not
<rss>(an XML error envelope, an Atom feed, a JSON body), on an<item>anywhere but directly inside the first<channel>(items wrapped in<items>, or in a second channel: they would be dropped unread), on one with no<channel>directly inside it (e.g. the portal's HTML shell or an empty body — the engine turns those into a typed LebensmittelwarnungParseError first, but this is a defensive backstop), and on an unterminated element, comment, CDATA section, processing instruction, declaration or tag (a truncated or hostile body).A single forward scan (
indexOffor every terminator), so parsing time is linear in the size of the body, whatever it contains. Only the direct children of the first<channel>and of its<item>s are read; a leaf's text is its decoded text plus its CDATA sections verbatim, and markup inside a leaf is kept as written. Element names match case-insensitively. The first occurrence of a leaf wins.