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);
            }
        }