parse_tags

Function parse_tags 

Source
pub fn parse_tags<'a, R>(
    namespace: &str,
    reader: &mut Reader<R>,
    callback: &mut dyn FnMut(Event<'a>) -> Result<()>,
) -> Result<()>
where R: BufRead,
Expand description

Parses an XML/HTML document looking for ESI tags in the specified namespace

This function reads from a buffered reader source and processes XML/HTML events, calling the provided callback for each event that matches an ESI tag.

§Arguments

  • namespace - The XML namespace to use for ESI tags (e.g. “esi”)
  • reader - Buffered reader containing the XML/HTML document to parse
  • callback - Function called for each matching ESI tag event

§Returns

  • Result<()> - Ok if parsing completed successfully, or Error if parsing failed

§Example

use esi::{Reader, parse_tags};

let xml = r#"<esi:include src="http://example.com/footer.html"/>"#;
let mut reader = Reader::from_str(xml);
let mut callback = |event| { Ok(()) };
parse_tags("esi", &mut reader, &mut callback)?;

§Errors

Returns an ExecutionError if there is an error reading or parsing the document.