I want to get the 3rd node of a branching node. Example
<rows>
<row>
<cell>a</cell>
<cell>b</cell>
<cell>c</cell>
<cell>d</cell>
<cell>e</cell>
<cell>f</cell></row>
<row>
<cell>aa</cell>
<cell>bb</cell>
<cell>cc</cell>
<cell>dd</cell>
<cell>ee</cell>
<cell>ff</cell>
</row>
......
</rows>
I basically want to get item c and cc and so on out. Basically the third cell element in rows. This is what i have. However what i want are the values of the items not the xml.
var Study = XDocument.Load(XmlReader.Create(studyStream));
var rows = Study.Descendants("row");
foreach (var item in rows)
{
var cells = item.Descendants("cell");
string id = null;
foreach (var items in cells)
{
id = items.Parent.FirstNode.NextNode.NextNode.ToString();
}
Console.WriteLine(id);
}
Console.Read();
Is there a way to do this properly? Thank you for all your help.
Kevin