I have the following xml file (shortened).As you can see, i want to get the second "maxtempC" Value.
<data>
<request>...</request>
<current_condition>...</current_condition>
<weather>
<date>2015-06-12</date>
<astronomy>...</astronomy>
<maxtempC>27</maxtempC>
<maxtempF>80</maxtempF>
<mintempC>14</mintempC>
<mintempF>58</mintempF>
<uvIndex>7</uvIndex>
<hourly>...</hourly>
<hourly>...</hourly>
<hourly>...</hourly>
<hourly>...</hourly>
</weather>
<weather>
<date>2015-06-13</date>
<astronomy>...</astronomy>
<maxtempC>25</maxtempC> //I want this Value
<maxtempF>77</maxtempF>
<mintempC>14</mintempC>
<mintempF>56</mintempF>
<uvIndex>6</uvIndex>
<hourly>...</hourly>
<hourly>...</hourly>
<hourly>...</hourly>
<hourly>...</hourly>
</weather>
</data>
I have tried it using the following:
XElement wData = XElement.Load(query);
string maxtempC2;
act_maxtempC2 = wData.Elements("weather")
.Skip(1)
.Take(1)
.Elements("maxtempC")
.Value;
I have also tried using this:
act_maxtempC2 = wData.Elements("weather")
.Skip(1)
.Take(1)
.Elements("maxtempC")
.Select(o => o.Value);
But in both cases, it gives not the Value of the Node, just a weird string like this: {System.Linq.Enumerable.WhereSelectEnumerableIterator}
I hope you can Help me