using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Net;

namespace 获取接口的数据
{
    class Program
    {
        static void Main(string[] args)
        {
            yihaodian(@"http://www.yihaodian.com/se/gouwuke/gouwuke.xml");
            Console.ReadKey();
        }

        public static void yihaodian(string filepath)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(filepath);

            XmlNode configNode = doc.SelectSingleNode("sitemapindex");

            XmlNodeList nodelist = configNode.ChildNodes;//.SelectSingleNode("sitemap").ChildNodes;  //.SelectSingleNode("loc")
            foreach (XmlNode node in nodelist)
            {
                string xmlpath = node.SelectSingleNode("loc").InnerText;
                //Console.WriteLine();
                jiexi_yihaodian(xmlpath);
               
               
            }
        }

        public static void jiexi_yihaodian(string xmlpath)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(xmlpath);
            XmlNodeList nodelists = doc.SelectSingleNode("boot").ChildNodes;
            foreach (XmlNode node in nodelists)
            {
                string ident = node.SelectSingleNode("ident").InnerText;
                string productname = node.SelectSingleNode("productname").InnerText;
                string refprice = node.SelectSingleNode("refprice").InnerText;
                string price_1 = node.SelectSingleNode("price_1").InnerText;
                string picurl = node.SelectSingleNode("picurl").InnerText;
                string url = node.SelectSingleNode("url").InnerText;
                string shortintro = node.SelectSingleNode("shortintro").InnerText;
                string orifenlei = node.SelectSingleNode("orifenlei").InnerText;
                string pinpai = node.SelectSingleNode("pinpai").InnerText;
                string chandi = node.SelectSingleNode("chandi").InnerText;
                string guige = node.SelectSingleNode("guige").InnerText;
                string color = node.SelectSingleNode("color").InnerText;
                Console.WriteLine(ident);
                Console.WriteLine(productname);
                Console.WriteLine(refprice);
                Console.WriteLine(price_1);
                Console.WriteLine(picurl);
                Console.WriteLine(url);
                Console.WriteLine(shortintro);
                Console.WriteLine(orifenlei);
                Console.WriteLine(pinpai);
                Console.WriteLine(chandi);
                Console.WriteLine(guige);
                Console.WriteLine(color);
               

            }
        }


    }
}