Esempio n. 1
0
        /// <summary>
        /// 子ノードより値で抽出する
        /// </summary>
        /// <param name="value"></param>
        /// <param name="deep"></param>
        /// <param name="reverse"></param>
        /// <returns></returns>
        public ExElements SelectNodesByValue(string value, bool deep = false, bool reverse = false)
        {
            var lst = new ExElements();

            foreach (var el in this)
            {
                if (reverse == false)
                {
                    if (el.Value == value)
                    {
                        lst.Add(el);
                    }
                }
                else
                {
                    if (el.Value != value)
                    {
                        lst.Add(el);
                    }
                }
                if (deep)
                {
                    lst.AddRange(el.SelectNodesByValue(value, true, reverse));
                }
            }
            return(lst);
        }
Esempio n. 2
0
        /// <summary>
        /// 子ノードよりタグ名で抽出する
        /// </summary>
        /// <param name="tagName"></param>
        /// <param name="deep"></param>
        /// <returns></returns>
        public ExElements SelectNodes(string tagName, bool deep = false)
        {
            var lst = new ExElements();

            foreach (var el in this)
            {
                if (el.Name == tagName)
                {
                    lst.Add(el);
                }
                if (deep)
                {
                    lst.AddRange(el.SelectNodes(tagName, true));
                }
            }
            return(lst);
        }