Load XML document by XPathDocument & XPathNodeIterator


String uri = "https://cumulus.services.live.com/" + Program.userName + "/LiveContacts/Contacts";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

XPathDocument doc = new XPathDocument(response.GetResponseStream());
XPathNavigator nav = doc.CreateNavigator();


XPathNodeIterator iter = nav.Select("//WindowsLiveID");
while (iter.MoveNext())
{
XPathNavigator navCurrent = iter.Current;
Console.WriteLine(navCurrent.ToString());
}

沒有留言:

發佈留言