Esempio n. 1
0
        /// <summary>
        /// 获取底部不确定标签
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static HeadValue GetBuDueDingDu_DiBu(HtmlAgilityPack.HtmlDocument doc)
        {
            var    buDueDingDu_DiBu = new HeadValue();
            string xpath            = @"//tbody[@class='dibubuque1']/tr/td/input[@type='text'] | //tbody[@class='dibubuque1']/tr/td/select";
            var    thead            = doc.DocumentNode.SelectNodes(xpath);

            if (thead != null)
            {
                List <MYDataHead> list = new List <MYDataHead>();
                foreach (var b in thead)
                {
                    MYDataHead mydata = new MYDataHead();
                    mydata.id   = b.Attributes["id"].Value;
                    mydata.name = b.Attributes["name"].Value;

                    if (b.Name == "input")
                    {
                        if (b.Attributes["value"] != null)
                        {
                            mydata.value = b.Attributes["value"].Value;
                        }
                    }
                    else if (b.Name == "select")
                    {
                        var nodes = b.ChildNodes
                                    .Where(w => (w.Name == "option" && w.Attributes["selected"] != null))
                                    .Select(s => s.Attributes["value"].Value).FirstOrDefault();

                        if (null == (nodes))
                        {
                            mydata.value = b.ChildNodes
                                           .Where(w => (w.Name == "option"))
                                           .Select(s => s.Attributes["value"].Value).First();
                        }
                        else
                        {
                            mydata.value = nodes;
                        }
                    }

                    list.Add(mydata);
                }
                buDueDingDu_DiBu.Data  = list;
                buDueDingDu_DiBu.Count = list.Count / 3;
            }


            return(buDueDingDu_DiBu);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取底部不确定标签
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static HeadValue GetBuDueDingDu_DiBu(HtmlAgilityPack.HtmlDocument doc)
        {
            var buDueDingDu_DiBu = new HeadValue();

            return(buDueDingDu_DiBu);
        }