I have the following code
XmlDocument doc = new XmlDocument();
doc.Load(xmlFileName);
XmlNode deeperNodes =
doc.DocumentElement.ChildNodes[11].ChildNodes[1].ChildNodes[3].ChildNodes[1].ChildNodes[2];
XmlNode deeperetNodes =
doc.DocumentElement.ChildNodes[11].ChildNodes[1].ChildNodes[3].ChildNodes[1].ChildNodes[3];
string firstValue = deeperNodes.Attributes["count"].Value.ToString();
string secondValue = deeperetNodes.Attributes["count"].Value.ToString();
The XML I am reading is to a given standard so is always the correct. Is there a better more robust way to read the values?
Update: Sample Xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Rn>
<Te>Fort</Te>
<Th></Th>
<Lh>c</Lh>
<Fe>C</Fe>
<Ue></Ue>
<RS></RS>
<RS></RS>
<RS></RS>
<RS> </RS>
<RS></RS>
<RS></RS>
<RS>
<Tl>New</Tl>
<SS>
<Tl>New</Tl>
<Description>A</Description>
<Text>The</Text>
<IssueListing>
<Refinement></Refinement>
<Chart ce="p">
<Axis>New</Axis>
<MajorAttribute>Anal</MajorAttribute>
<GroupingSection count="38">
<groupTl>Is</groupTl>
</GroupingSection>
<GroupingSection count="364">
<groupTl>Is</groupTl>
</GroupingSection>
</Chart>
</IssueListing>
</SS>
</RS>
</Rn>