Class file:
[TestMethod]
public void readXml()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("D:\\Data.xml");
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/Testing/Tools");
string proID = "", pro_name = "", pro_item = "";
foreach (XmlNode node in nodeList)
{
proID = node.SelectSingleNode("Tool").InnerText;
pro_name = node.SelectSingleNode("Performance").InnerText;
pro_item = node.SelectSingleNode("Mobile").InnerText;
// MessageBox.Show(proID + " " + proName + " " + price);
Console.WriteLine(proID);
Console.WriteLine(pro_name);
Console.WriteLine(pro_item);
}
}
----------------------------------------------------------------------
Xml file -
-----------------------------------------
[TestMethod]
public void readXml()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("D:\\Data.xml");
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/Testing/Tools");
string proID = "", pro_name = "", pro_item = "";
foreach (XmlNode node in nodeList)
{
proID = node.SelectSingleNode("Tool").InnerText;
pro_name = node.SelectSingleNode("Performance").InnerText;
pro_item = node.SelectSingleNode("Mobile").InnerText;
// MessageBox.Show(proID + " " + proName + " " + price);
Console.WriteLine(proID);
Console.WriteLine(pro_name);
Console.WriteLine(pro_item);
}
}
----------------------------------------------------------------------
Xml file -
-----------------------------------------