HtmlParser class

Parser for HTML, which generates a tree structure from a stream of (possibly malformed) characters.

Constructors

HtmlParser(dynamic input, {String? encoding, bool parseMeta = true, bool lowercaseElementName = true, bool lowercaseAttrName = true, bool strict = false, bool generateSpans = false, String? sourceUrl, TreeBuilder? tree})
Create an HtmlParser and configure the tree builder and strict mode. The input can be a String, List<int> of bytes or an HtmlTokenizer.

Properties

compatMode String
"quirks" / "limited quirks" / "no quirks"
getter/setter pair
errors List<ParseError>
final
firstStartTag bool
getter/setter pair
framesetOK bool
getter/setter pair
generateSpans bool
True to generate SourceSpans for the Node.sourceSpan property.
final
hashCode int
The hash code for this object.
no setterinherited
innerHTML String?
innerHTML container when parsing document fragment.
getter/setter pair
innerHTMLMode bool
no setter
originalPhase Phase?
getter/setter pair
phase Phase
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strict bool
Raise an exception on the first error encountered.
final
tokenizer → HtmlTokenizer
final
tree → TreeBuilder
final

Methods

adjustForeignAttributes(StartTagToken token) → void
adjustMathMLAttributes(StartTagToken token) → void
adjustSVGAttributes(StartTagToken token) → void
inForeignContent(Token token, int type) bool
isHTMLIntegrationPoint(Element element) bool
isMathMLTextIntegrationPoint(Element element) bool
mainLoop() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse() Document
Parse an html5 document into a tree. After parsing, errors will be populated with parse errors, if any.
parseError(SourceSpan? span, String errorcode, [Map<String, Object?>? datavars = const {}]) → void
parseFragment([String container = 'div']) DocumentFragment
Parse an html5 document fragment into a tree. Pass a container to change the type of the containing element. After parsing, errors will be populated with parse errors, if any.
parseRCDataRawtext(Token token, String contentType) → void
Generic RCDATA/RAWTEXT Parsing algorithm contentType - RCDATA or RAWTEXT
reset() → void
resetInsertionMode() → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited