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

            string input = reader.ReadToEnd();

            while (input != "")
                parseHtml(ref input);
        }
Пример #4
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);
        }
Пример #5
0
        /// <summary>
        /// Parse Html
        /// </summary>
        public void Parse(TextReader reader)
        {
            previousNode = null;

            string input = reader.ReadToEnd();

            while (input != "")
            {
                parseHtml(ref input);
            }
        }
Пример #6
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;
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
            }
        }
Пример #10
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;
        }