读取xml Rss 的两种方式

 

               //原始操作Rss
                XmlDocument xml = new XmlDocument();
                xml.Load("http://digi.tech.qq.com/mobile/manufacturer/rss_manufacturer.xml");
                XmlNodeList list = xml.GetElementsByTagName("item");
                foreach (XmlNode node in list)
                {
                    Response.Write("<a target='_blank' href='" + node["link"].InnerText + "'>" + node["title"].InnerText + "</a>" + "<br>");
                }

                //Linq 操作Rss
                XElement root = XElement.Load("http://digi.tech.qq.com/mobile/manufacturer/rss_manufacturer.xml");
                var nodelist = root.Descendants("item");
                var query = from v in nodelist select v;
                foreach (var s in query)
                {
                    Response.Write("<a target='_blank' href='" + s.Element("link").Value + "'>" + s.Element("title").Value + "</a>" + "<br>");
                }

你可能感兴趣的:(xml,list,rss,query)