예제 #1
0
        /// <summary>
        /// 获得指定标签名称的元素对象
        /// </summary>
        /// <param name="vName">元素标签名称</param>
        /// <returns>保存找到的元素的列表对象</returns>
        public HTMLElementList GetElementsByTagName(string vName)
        {
            HTMLElementList myList = new HTMLElementList();

            if (this.Body != null)
            {
                this.Body.InnerGetElementsByTagName(vName, myList);
            }
            return(myList);
        }
예제 #2
0
 internal virtual void InnerGetAllElement(HTMLElementList list)
 {
     foreach (HTMLElement element in myChildNodes)
     {
         list.Add(element);
         if (element is HTMLContainer)
         {
             (( HTMLContainer )element).InnerGetAllElement(list);
         }
     }
 }
예제 #3
0
        /// <summary>
        /// 获得所有指定名称的元素
        /// </summary>
        /// <param name="vName">名称</param>
        /// <param name="myList">保存获得到元素的列表</param>
        /// <returns>获得到元素的个数</returns>
        internal virtual int InnerGetElementsByName(string vName, HTMLElementList myList)
        {
            int iCount = 0;

            foreach (HTMLElement e in myChildNodes)
            {
                if (e.GetAttribute(StringConstAttributeName.Name) == vName)
                {
                    myList.Add(e);
                    iCount++;
                }
                if (e is HTMLContainer)
                {
                    iCount += (( HTMLContainer)e).InnerGetElementsByName(vName, myList);
                }
            }
            return(iCount);
        }
예제 #4
0
        /// <summary>
        /// 获得所有指定标签名称的元素
        /// </summary>
        /// <param name="vTagName">指定的标签名称</param>
        /// <param name="myList">保存获得到元素的列表</param>
        /// <returns>获得到元素的个数</returns>
        internal virtual int InnerGetElementsByTagName(string vTagName, HTMLElementList myList)
        {
            int iCount = 0;

            foreach (HTMLElement e in myChildNodes)
            {
                if (e.TagName == vTagName)
                {
                    myList.Add(e);
                    iCount++;
                }
                if (e is HTMLContainer)
                {
                    iCount += (( HTMLContainer)e).InnerGetElementsByTagName(vTagName, myList);
                }
            }
            return(iCount);
        }