Exemplo n.º 1
0
        protected bool CreateTag(string tag, int htmlStart, int textStart, int textEnd, int htmlEnd,
            HtmlNode parent, out HtmlNode node)
        {
            node = null;

            if (htmlEnd != -1 && htmlEnd <= htmlStart)
            {
                return false;
            }

            if (textEnd != -1 && textEnd < textStart)
            {
                return false;
            }

            node = new HtmlNode(tag, htmlStart, textStart, textEnd, htmlEnd, context.HtmlContext, parent);

            if (context.PreviousNode != null)
            {
                node.SetPreviousNode(context.PreviousNode);
                context.PreviousNode.SetNextNode(node);
            }

            context.PreviousNode = node;

            return parent == null;
        }