// 네이버 오늘의 환율 시세 출력 (C#)
public void PrintTodayCurrencyExchangeRates()
{
WebClient client = new WebClient();
client.Headers.Add(“Referer”, “http://blog.naver.com/usback“);
Stream xmlDataStream = client.OpenRead(
“http://www.naver.com/include/timesquare/widget/exchange.xml“);
XmlReader reader = XmlReader.Create(xmlDataStream);
reader.MoveToContent();
while (reader.ReadToFollowing(“currency”))
{
reader.ReadToFollowing(“hname”);
string hname = reader.ReadElementContentAsString(“hname”,
reader.NamespaceURI);
reader.ReadToFollowing(“standard”);
double standard = reader.ReadElementContentAsDouble(“standard”,
reader.NamespaceURI);
reader.ReadToFollowing(“buy”);
double buy = reader.ReadElementContentAsDouble(“buy”,
reader.NamespaceURI);
reader.ReadToFollowing(“sell”);
double sell = reader.ReadElementContentAsDouble(“sell”,
reader.NamespaceURI);
reader.ReadToFollowing(“sign”);
string sign = reader.ReadElementContentAsString(“sign”,
reader.NamespaceURI);
Console.WriteLine(“{0}\t{1}\t{2}\t{3}\t{4}”, hname, standard, buy, sell, sign);
}
}