pub enum HtmlEvent<'a> {
StartElement {
name: &'a str,
attributes: HtmlAttrs<'a>,
},
EndElement {
name: &'a str,
},
Text(&'a str),
Comment(&'a str),
Doctype {
name: &'a str,
public_id: &'a str,
system_id: &'a str,
},
Eof,
}Expand description
A tree-construction event emitted by the streaming HTML parser.
Variants§
StartElement
An element start tag. Self-closing source forms (<br/>)
and void elements (<br>) both emit a single StartElement;
for void elements no matching EndElement follows. For
non-void elements the matching EndElement follows after
the element’s content events.
Fields
EndElement
An element end tag. Emitted for every non-void element that was opened, including ones implicitly closed by html5ever’s recovery.
Text(&'a str)
A character data run. Adjacent text events from html5ever are coalesced into a single event by the streaming sink, so consumers don’t see arbitrarily-fragmented text.
Comment(&'a str)
An HTML comment, with the surrounding <!-- / -->
delimiters stripped.
Doctype
The document <!DOCTYPE> declaration. Emitted at most once
per document, before any element events.
Eof
End of input. Subsequent calls to
HtmlReader::next keep
returning Eof.