I have the following xml file from an API,
<IPInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.cdyne.com/">
<City>xxxxxx</City>
<StateProvince>12</StateProvince>
<Country>xxxxxx</Country>
<Organization/>
<Latitude>13.0833</Latitude>
<Longitude>80.28329</Longitude>
<AreaCode>0</AreaCode>
<TimeZone/>
<HasDaylightSavings>false</HasDaylightSavings>
<Certainty>90</Certainty>
<RegionName/>
<CountryCode>xx</CountryCode>
</IPInformation>
I need to get the Latitude and Longitude values from above xml and store it in a string.
I am working on c# .net 3.5 framework, I tried the below code,
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(response.GetResponseStream());
location = xmlDoc.DocumentElement.SelectSingleNode("//City");
latitude = xmlDoc.DocumentElement.SelectSingleNode("//Latitude");
I am always getting Null instead of 13.0833 and 80.28329.
Can any one tell me how to retrieve the Latitude and Longitude values from above xml.
Thanks
latitudeandlongitude? The methodSelectSingleNodedoes not parse the content of the selected node; its return type isXmlNode, which has to be process further to achieve parsing.SelectSingleNodecall returns null...