개발/개발 자료

(C#) XML파싱

시원한물냉 2015. 1. 22. 15:31

using System.Xml;


private HttpGet req = new HttpGet();


string url = "xml 형태의 주소";

req.Request(url);

XmlReader reader = XmlReader.Create(new StringReader(req.ResponseBody));

try{

reader.ReadToFollowing("NAME");  

string xValue = reader.ReadElementContentAsString();  

Console.WriteLine(xValue);


} catch (Exception){

Console.WriteLine("Exception");

}

reader.Close();