Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            XElement axElement = XElement.Load("http://www.kma.go.kr/wid/queryDFSRSS.jsp?zone=2623052000");
            var      XMLData   = from Temp in axElement.Descendants("data")
                                 select new Weather
            {
                Hour  = Temp.Element("hour").Value,
                Temp  = Temp.Element("temp").Value,
                Wfkor = Temp.Element("wfKor").Value,
                Wdkor = Temp.Element("wdKor").Value,
            };

            foreach (var Temp in XMLData)
            {
                Console.WriteLine(Temp);
            }

            //foreach (var Temp in XMLData)
            //{
            //    Console.Write(Temp.Element("hour").Value + "시\t\t");
            //    Console.Write(Temp.Element("temp").Value + "℃\t\t");
            //    Console.Write(Temp.Element("wfKor").Value + "\t\t");
            //    Console.Write(Temp.Element("wdKor").Value + "풍\t\t");
            //    Console.WriteLine();
            //}
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            XElement aXElement = XElement.Load("http://www.kma.go.kr/wid/queryDFSRSS.jsp?zone=2623052000");
            //Console.WriteLine(aXElement);
            var XMLData = from Temp in aXElement.Descendants("data") select Temp;

            foreach (var Temp in XMLData)
            {
                Console.WriteLine(Temp.Element("hour").Value + "시\t");
                Console.WriteLine(Temp.Element("temp").Value + "°C\t");
                Console.WriteLine();
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            XElement aXElement = XElement.Load("http://www.kma.go.kr/wid/queryDFSRSS.jsp?zone=2623052000");
            //Console.WriteLine(aXElement);
            var XMLData = from Temp in aXElement.Descendants("data") select new weather()
            {
                Hour  = Temp.Element("hour").Value,
                Temp  = Temp.Element("temp").Value,
                WfKor = Temp.Element("wfKor").Value,
                WdKor = Temp.Element("wdKor").Value
            };

            foreach (var Temp in XMLData)
            {
                Console.WriteLine(Temp);
            }
        }