I have the following code and I cannot figure why xnList is always an empty list. I'm not sure if "xml" doesn't contain what I think it does, of if my XPath expression is wrong.
This is the XML file I'm fetching:
http://picasaweb.google.com/data/feed/api/user/ghebert?kind=album
This is the XML file I'm fetching:
http://picasaweb.google.com/data/feed/api/user/ghebert?kind=album
Code:
string url = "http://picasaweb.google.com/data/feed/api/user/" + username.Text + "?kind=album";
WebRequest request = WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
response.Close();
dataStream.Close();
reader.Close();
XmlDocument xml = new XmlDocument();
xml.LoadXml(responseFromServer);
XmlNodeList xnList = xml.SelectNodes("/feed/entry");
MessageBox.Show("Found: " + Convert.ToString( xnList.Count ));