Class HtmlParser
- Namespace
- AngleSharp.Html.Parser
- Assembly
- AngleSharp.dll
Creates an instance of the HTML parser front-end.
public class HtmlParser : EventTarget, IHtmlParser, IParser, IEventTarget
- Inheritance
-
HtmlParser
- Implements
- Inherited Members
- Extension Methods
Constructors
HtmlParser()
Creates a new parser with the default options and context.
public HtmlParser()
HtmlParser(HtmlParserOptions)
Creates a new parser with the custom options.
public HtmlParser(HtmlParserOptions options)
Parameters
options
HtmlParserOptionsThe options to use.
HtmlParser(HtmlParserOptions, IBrowsingContext?)
Creates a new parser with the custom options and the given context.
public HtmlParser(HtmlParserOptions options, IBrowsingContext? context)
Parameters
options
HtmlParserOptionsThe options to use.
context
IBrowsingContextThe context to use.
Properties
Options
Gets the specified options.
public HtmlParserOptions Options { get; }
Property Value
Methods
ParseDocument(Stream)
Parses the stream and returns the result.
public IHtmlDocument ParseDocument(Stream source)
Parameters
source
Stream
Returns
ParseDocument(string)
Parses the string and returns the result.
public IHtmlDocument ParseDocument(string source)
Parameters
source
string
Returns
ParseDocumentAsync(Stream, CancellationToken)
Parses the stream asynchronously with option to cancel.
public Task<IHtmlDocument> ParseDocumentAsync(Stream source, CancellationToken cancel)
Parameters
source
Streamcancel
CancellationToken
Returns
ParseDocumentAsync(string, CancellationToken)
Parses the string asynchronously with option to cancel.
public Task<IHtmlDocument> ParseDocumentAsync(string source, CancellationToken cancel)
Parameters
source
stringcancel
CancellationToken
Returns
ParseFragment(Stream, IElement)
Parses the stream and returns the result.
public INodeList ParseFragment(Stream source, IElement contextElement)
Parameters
Returns
ParseFragment(string, IElement)
Parses the string and returns the result.
public INodeList ParseFragment(string source, IElement contextElement)
Parameters
Returns
ParseHead(Stream)
Parses the stream and returns the head.
public IHtmlHeadElement? ParseHead(Stream source)
Parameters
source
Stream
Returns
ParseHead(string)
Parses the string and returns the head.
public IHtmlHeadElement? ParseHead(string source)
Parameters
source
string
Returns
ParseHeadAsync(Stream, CancellationToken)
Parses the stream asynchronously with option to cancel.
public Task<IHtmlHeadElement?> ParseHeadAsync(Stream source, CancellationToken cancel)
Parameters
source
Streamcancel
CancellationToken
Returns
ParseHeadAsync(string, CancellationToken)
Parses the string asynchronously with option to cancel.
public Task<IHtmlHeadElement?> ParseHeadAsync(string source, CancellationToken cancel)
Parameters
source
stringcancel
CancellationToken
Returns
Events
Error
Fired when a HTML parse error is encountered.
public event DomEventHandler Error
Event Type
Parsed
Fired when the HTML parser is finished.
public event DomEventHandler Parsed
Event Type
Parsing
Fired when the HTML parser is starting.
public event DomEventHandler Parsing