// // implementation methods // #region protected virtual void Init(string text, IParserComponentFactory factory) /// <summary> /// Initializes this instance with the text and factory. Inheritors can override /// </summary> /// <param name="text"></param> /// <param name="factory"></param> protected virtual void Init(string text, IParserComponentFactory factory, IParserStyleFactory styles, HTMLParserSettings settings) { if (null == settings) { throw new ArgumentNullException(nameof(settings)); } if (null == factory) { factory = new HTMLParserComponentFactory(); } if (null == styles) { styles = new CSSStyleItemAllParser(); } _text = text; _instanceFact = factory; _settings = settings; _styleFact = styles; _shouldlog = null != _settings.Context; }
// // implementation methods // #region protected virtual void Init(string text, IParserComponentFactory factory) /// <summary> /// Initializes this instance with the text and factory. Inheritors can override /// </summary> /// <param name="text"></param> /// <param name="factory"></param> protected virtual void Init(string text, IParserComponentFactory factory, IParserStyleFactory styles, HTMLParserSettings settings) { if (null == factory) { factory = new HTMLParserComponentFactory(); } if (null == styles) { styles = new CSSStyleItemAllParser(); } if (null == settings) { settings = new HTMLParserSettings(); } _text = text; _instanceFact = factory; _settings = settings; _styleFact = styles; _shouldlog = null != _settings.TraceLog && _settings.TraceLog.ShouldLog(_settings.LogLevel); }
/// <summary> /// Creates a new instance of an HTMLParser that will convert the specified text into a series of Components using the component factory. /// </summary> /// <param name="text"></param> /// <param name="componentFactory">The component factory (can be null)</param> /// <param name="styleFactory">The style value factory (can be null)</param> /// <param name="settings">The parser settings (can be null)</param> public HTMLParser(string text, IParserComponentFactory componentFactory, IParserStyleFactory styleFactory, HTMLParserSettings settings) { this.Init(text, componentFactory, styleFactory, settings); }
/// <summary> /// Creates a new instance of the HTMLParser that will convert the specified text into a series of Components in a ParserResult, /// using the provided settings /// </summary> /// <param name="text"></param> public HTMLParser(string text, HTMLParserSettings settings) : this(text, null, null, settings) { }