I am parsing a XML document using Xpath. The steps node have Attributes in the form of step. I am trying to get the value of each step. For example 0.03, 0.025,0.05.... But with my Code I only get the 1st value i.e 0.03 in the list of strings. Here is the Code that I tried:
private void btn_steps_Click(object sender, EventArgs e)
{
List<string> step = new List<string>();
XmlDocument doctst = new XmlDocument();
doctst.Load(@"C:\ehData\workData\mywork.xml");
XmlNodeList nodelistst = doctst.Selectnodes("//steps");
foreach (XmlNode node in nodelistst)
{
step.Add(node["step"].InnerText);
}
listBox2.DataSource = step;
}
Moreover, I am attaching the XML file image that I am trying to parse. What I am doing wrong in this Code?
Here are the few lines of the XML file
<devices orderNo="67354698">
<device serno="P1002001190">
<steps>
<step descriptor="160000556" element="1" usage="B">0.03</step>
<step descriptor="160000556" element="2" usage="B">0.025</step>
<step descriptor="160000556" element="3" usage="B">0.05</step>
