Skip to main content

HtmlSaxHandler

Trait HtmlSaxHandler 

Source
pub trait HtmlSaxHandler {
    // Provided methods
    fn start_element(&mut self, _name: &str, _attrs: HtmlAttrs<'_>) { ... }
    fn end_element(&mut self, _name: &str) { ... }
    fn text(&mut self, _content: &str) { ... }
    fn comment(&mut self, _content: &str) { ... }
    fn doctype(&mut self, _name: &str, _public_id: &str, _system_id: &str) { ... }
    fn parse_error(&mut self, _err: &XmlError) { ... }
    fn end_document(&mut self) { ... }
}
Expand description

Callback trait for the push-based HtmlSaxParser. All methods have default no-op implementations — implementers override only the events they care about (e.g. an <a href> extractor only needs start_element).

libxml2 / lxml / Nokogiri analogue. Argument shape mirrors libxml2’s xmlSAXHandler — flat parameters per callback rather than packing them into payload structs.

Provided Methods§

Source

fn start_element(&mut self, _name: &str, _attrs: HtmlAttrs<'_>)

Source

fn end_element(&mut self, _name: &str)

Source

fn text(&mut self, _content: &str)

Source

fn comment(&mut self, _content: &str)

Source

fn doctype(&mut self, _name: &str, _public_id: &str, _system_id: &str)

Source

fn parse_error(&mut self, _err: &XmlError)

Source

fn end_document(&mut self)

Called once after the last token has been processed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§