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

            string input = reader.ReadToEnd();

            while (input != "")
            {
                parseHtml(ref input);
            }
        }
Esempio 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);
        }
Esempio n. 4
0
        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);
        }
Esempio 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);
            }
        }