using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace WinFormEx
{
public partial class Ex04 : Form
{
public Ex04()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//http://openapi.naver.com/search?key=7a6113b7791ce0313cb577f437131e3d&query=nexearch&target=rank
XmlDocument doc = new XmlDocument();
doc.Load("http://openapi.naver.com/search?key=7a6113b7791ce0313cb577f437131e3d&query=people&target=ranktheme");
//doc.Load("http://openapi.naver.com/search?key=&query=people&target=rank");
XmlElement item = doc.DocumentElement.FirstChild as XmlElement;
int n = 1;
listView1.Items.Clear();//**
foreach (XmlElement rn in item.ChildNodes)
{
ListViewItem vItem = new ListViewItem(n.ToString());//순위
vItem.SubItems.Add(rn.FirstChild.InnerText);//검색어
vItem.SubItems.Add(rn.ChildNodes[1].InnerText);//변동
n++;
listView1.Items.Add(vItem);
}
}
private void Ex04_Load(object sender, EventArgs e)
{
}
}
}