public AnalyzerContext(string html, HtmlParser parser) { this.html = html; this.parser = parser; this.eof = html.Length; this.openTags = CreateOpenTags(); this.closeTags = CreateCloseTags(); //If parent is not null, we can use that html context htmlContext = new HtmlContext(html); }
public SearchAnalyzerContext(string html) { this.html = html; this.eof = html.Length; this.openTags = new List<IOpenTag>() { new OpenTagAnalyzer(this), new MetaTagAnalyzer(this), new CommentAnalyzer(this) }; this.closeTags = new List<ICloseTag>() { new CloseTagAnalyzer(this) }; htmlContext = new HtmlContext(html); }
private HtmlNode( string tag, HtmlNode parent, HtmlContext context, List<HtmlStyle> htmlStyles, List<HtmlStyle> inheritedStyles, bool isText, int htmlStart, int textStart, int textEnd, int htmlEnd, bool selfClosing, List<HtmlNode> children, HtmlNode previous, HtmlNode next, Dictionary<string, string> attributes, Dictionary<string, string> styles) { this.tag = tag; this.parent = parent; this.context = context; this.htmlStyles = htmlStyles; this.isText = isText; this.htmlStart = htmlStart; this.textStart = textStart; this.textEnd = textEnd; this.htmlEnd = htmlEnd; this.selfClosing = selfClosing; if (children != null) { this.children = new List<HtmlNode>(); foreach (var child in children) { this.children.Add(child); } } this.previous = previous; this.next = next; if (attributes != null) { this.attributes = new Dictionary<string, string>(); foreach (var attribute in attributes) { this.attributes.Add(attribute.Key, attribute.Value); } } if (styles != null) { this.styles = new Dictionary<string, string>(); foreach (var style in styles) { this.styles.Add(style.Key, style.Value); } } }
internal HtmlNode(string tag, int htmlStart, int textStart, HtmlContext context, HtmlNode parent) { if (string.IsNullOrEmpty(tag)) { throw new ArgumentNullException("tag"); } if (context == null) { throw new ArgumentNullException("context"); } this.tag = tag; this.htmlStart = htmlStart; this.textStart = textStart; this.textEnd = -1; this.htmlEnd = -1; this.context = context; this.parent = parent; htmlStyles = new List<HtmlStyle>(); inheritedHtmlStyles = new List<HtmlStyle>(); isText = tag == HtmlTag.TEXT; if (parent != null) { parent.AddChild(this); } }
internal HtmlNode(string tag, int htmlStart, int textStart, int textEnd, int htmlEnd, HtmlContext context, HtmlNode parent) : this(tag, htmlStart, textStart, context, parent) { SetBoundary(textEnd, htmlEnd); }