Skip to main content

parse_html_str

Function parse_html_str 

Source
pub fn parse_html_str(input: &str) -> Result<Document, XmlError>
Expand description

Parse an HTML document from a UTF-8 string into the arena DOM.

Defaults are tuned for browser-equivalent output and lenient recovery — see HtmlParseOptions for the knobs.

Errors: returns Err only when an internal limit is exceeded (HtmlParseOptions::max_element_depth, HtmlParseOptions::max_text_bytes) or when HtmlParseOptions::recovery_mode is false and the parser encountered a well-formedness violation. In recovery mode (the default) parse errors are recovered into the resulting tree; retrieve them via parse_html_str_with_recovered.