I have an xml file that looks like this;
<?xml version="1.0" encoding="utf-8"?>
<!--This file is generated by the program.-->
<Product ID="23" Name="Soap" test="one">
<Price>10.00</Price>
<OtherDetails>
<BrandName>X Soap</BrandName>
<Manufacturer>X Company</Manufacturer>
</OtherDetails>
</Product>
I can use the following code to read the 'ID', 'Name', and 'test;
XmlReader reader = XmlReader.Create("Products.xml");
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "Product")
{
textBox1.AppendText(reader.GetAttribute(0));
textBox1.AppendText(reader.GetAttribute("Name"));
textBox1.AppendText(reader.GetAttribute("2"));
}
}
reader.Close();
}
My problem is, how can I read the value in the elements like '10.00', 'X Soap', and 'X Company'?