public HtmlTree(ITextProvider text, IHtmlScriptTypeResolutionService scriptTypeResolution, IHtmlScriptOrStyleTagNamesService scriptOrStyleTagNameService, ParsingMode parsingMode) { Text = text; ScriptTypeResolution = scriptTypeResolution; ScriptOrStyleTagNameService = (scriptOrStyleTagNameService ?? new DefaultScriptOrStyleTagNameService()); ParsingMode = parsingMode; HtmlClosureProvider = new HtmlClosureProvider(); CommentCollection = new CommentCollection(); // Create root node last when all fields are intialized RootNode = new RootNode(this); }
/// <summary> /// Creates HTML parser /// </summary> /// <param name="parsingMode"> /// Parsing mode (HTML, XHTML or XML). HTML and XHTML differ in element /// and attribute name case-sensitity while XML mode treats <script> /// and <style elements as regular elements. /// </param> /// <param name="scriptTypeResolution"> /// A service that helps parser to detemine if content of a <script> /// block should be skipped over (normal behavior) or should parser /// continue parsing inside the block since block content is actually /// a markup, like in <script type="text/x-handlebars-template">. /// </param> public HtmlParser(ParsingMode parsingMode, IHtmlScriptTypeResolutionService scriptTypeResolution, IHtmlScriptOrStyleTagNamesService scriptOrStyleTagNameService) { ParsingMode = parsingMode; ScriptTypeResolution = scriptTypeResolution; ScriptOrStyleTagNameService = (scriptOrStyleTagNameService ?? new DefaultScriptOrStyleTagNameService()); Stats = new HtmlParserStatistic(); }