rss_gen::parser

Function parse_rss

Source
pub fn parse_rss(
    xml_content: &str,
    config: Option<&ParserConfig>,
) -> Result<RssData>
Expand description

Parses an RSS feed from XML content.

This function takes XML content as input and parses it into an RssData struct. It supports parsing RSS versions 0.90, 0.91, 0.92, 1.0, and 2.0.

§Arguments

  • xml_content - A string slice containing the XML content of the RSS feed.
  • config - Optional configuration for custom parsing behavior.

§Returns

  • Ok(RssData) - The parsed RSS data if successful.
  • Err(RssError) - An error if parsing fails.

§Errors

This function returns an Err(RssError) in the following cases:

  • If the XML content is invalid or malformed, a RssError::XmlParseError is returned.
  • If an unsupported or invalid RSS version is encountered, a RssError::InvalidInput is returned.
  • If an unknown or unsupported element is encountered during parsing, a RssError::UnknownElement is returned.