Skip to main content

looks_like_xml

Function looks_like_xml 

Source
pub fn looks_like_xml(src: &str) -> bool
Expand description

Pre-check for XML-shaped input so we don’t pay the html5ever cost on pure-Markdown text. Accepts the canonical <?xml version declaration, an explicit <!DOCTYPE, and bare tags that start with < + an ASCII letter (so <heading> triggers but <3 and < x don’t).

The caller is expected to strip_xml_prolog before parsing to remove <?xml ... ?> declarations that html5ever does not recognise.