Exemplo n.º 1
0
 ///<summary> Constructor. </summary>
 public HtmlTagNode(HtmlTagNode aParentNode, HtmlTag aTag) : base()
 {
     isRoot     = false;
     parentNode = aParentNode;
     tag        = aTag;
     childTags  = new List <HtmlTagNode>();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Parse Html
        /// </summary>
        public void Parse(TextReader reader)
        {
            previousNode = null;

            string input = reader.ReadToEnd();

            while (input != "")
            {
                parseHtml(ref input);
            }
        }
Exemplo n.º 3
0
        /// <summary> Add a Non TextTag to Tag List </summary>
        internal void addTag(HtmlTag aTag)
        {
            //            HtmlTagNode newNode = new HtmlTagNode(
            if (previousNode == null)
            {
                previousNode = tree;
            }

            while (!previousNode.CanAdd(aTag))
            {
                previousNode = previousNode.Parent;
            }

            previousNode = previousNode.Add(aTag);
        }
Exemplo n.º 4
0
        private static string printNode(Int32 level, HtmlTagNode node)
        {
            string spacing = " ";
            string retVal  = "";

            for (int i = 0; i < level; i++)
            {
                spacing += "  ";
            }

            retVal += spacing + node.ToString() + '\r' + '\n';

            foreach (HtmlTagNode subnode in node)
            {
                retVal += HtmlTagTree.printNode(level + 1, subnode);
            }

            return(retVal);
        }
Exemplo n.º 5
0
        public HtmlTagNode Add(HtmlTag aTag)
        {
            if (!CanAdd(aTag))
            {
                throw new Exception("Cannot add here, check your coding.");
            }

            HtmlTagNode retVal = new HtmlTagNode(this, aTag);

            Items.Add(retVal);

            if (aTag.Name == '/' + tag.Name)
            {
                return(Parent);
            }
            else
            {
                return(retVal);
            }
        }