Functions
The text of HTML's named character reference name, given without & and ;, or null when HTML has no such name.
Fold the tokens into a tree. Strict about nesting only where it can be: an end tag closes the nearest matching open element and is ignored when nothing matches, so a stray </b> cannot truncate the document.
The flat token stream: start tags with attributes, end tags, and text. Tag soup is salvaged, never rejected. Use parse for a tree; callers that need HTML's implied end tags fold the tokens themselves. A comment is a KiteXmlToken.Comment for keepComments, and is skipped otherwise.
tokenize for a document served as text/html: a numeric character reference follows HTML's rules, so one to 0x80..0x9F maps through windows-1252 and one to 0, a surrogate or past U+10FFFF is U+FFFD (HTML, 13.2.5.80; #871). An XHTML document keeps XML's rules.
Where xml breaks the well-formedness rules of XML 1.0 and of Namespaces in XML 1.0, as a non-validating processor reads it: names, tags that do not match or never close, quotes, references, and undeclared prefixes. Empty for a well-formed document. tokenize and parse salvage such a document anyway; this says what they salvaged (#517). Stops after limit errors.