Xml file name is "CompSpecs"
{
string path = @"";
FileStream READER = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); //Set up the filestream (READER) //
System.Xml.XmlDocument CompSpecs = new System.Xml.XmlDocument();// Set up the XmlDocument (CompSpecs) //
CompSpecs.Load(READER); //Load the data from the file into the XmlDocument (CompSpecs) //
System.Xml.XmlNodeList NodeList = CompSpecs.GetElementsByTagName("CompSpecs");
textBox1.Text = NodeList[0].FirstChild.NextSibling.ChildNodes[0].InnerText;
}
My XML FILE IS
<?xml version="1.0" ?>
- <CompSpecs>
- <CP>
<Type>intel Hp Core2DU</Type>
<RAM>4GBszz</RAM>
<CPU_Speed>3.8Ghz</CPU_Speed>
</CP>
- <CP>
<Type>intel dell</Type>
<RAM>4GB</RAM>
<CPU_Speed>3.8Ghz</CPU_Speed>
</CP>
</CompSpecs>