Reputation: 115
So basically, working on a xml file, that looks like this:
...
<city id="thatstheid">
<country id="anotherid"> VALUE </country>
</city>
...
and i read the stuff i need using:
XmlDocument doc;//let's say this is the file im reading
XmlNode cityNode = doc.DocumentElement.SelectSingleNode("city");
cityname = cityNode.Attributes["id"].Value;
XmlNode countryNode = cityNode.SelectSingleNode("country");
countryname = countryNode.Value;
The problem here being that
countryname = countryNode.Value;
brings back an empty value, even though there's something inside.
If i try to get any atributes from the inside like this :
countryname = countryNode.Attributes["id"].Value;
it works fine, so i don't know what's the problem.
Upvotes: 0
Views: 979