I'm having trouble with XDocument. What I need is to get the value of a node called "LocalityName" in this xml: http://maps.google.com/maps/geo?q=59.4344,24.3342&output=xml&sensor=false
I had this done using XmlDocument:
XmlDocument doc = new XmlDocument();
doc.Load("http://maps.google.com/maps/geo?q=54.9133,23.9001&output=xml&sensor=false");
XmlNodeList myElement = doc.GetElementsByTagName("Locality");
foreach (XmlNode node in myElement)
{
XmlElement myElement = (XmlElement)node;
string varN = myElement.GetElementsByTagName("LocalityName")[0].InnerText;
Don't know if it's the best way, but it worked. Now I need to do the same with XDocument. I have been searching for the whole evening, but nothing works for me. Please point me out in the right direction. Thank you!