I have an xml name as recipe.xml
<sections>
<section name="Template">
<item key="SkipTemplates" value="C:/Temp/skip.xm;" />
<item key="validateTemplate" value="C:/Temp/validate.xml" />
<item key="PassTemplate" value="C:/Temp/pass.xml" />
</section>
<section name="Version">
<item key="MenuTemplate" value="C:/TempVersion/menu.xml" />
<item key="PassTemplate" value="C:/TempVersion/pass.xml" />
<item key="SkipTemplate" value="C:/TempVersion/skip.xml" />
</section>
</sections>
I wish to used C# code to return me the value of each node. For example: I want to get the value(C:/Temp/validate.xml) for the node that name (validateTemplate)
I have try below code but return me error:
XmlDocument xml = new XmlDocument();
xml.Load("C:/Mani/recipe.xml");
XmlElement directoryElement = xml.GetElementById("validateTemplate");
string backupPath = directoryElement.GetAttribute("value");
MessageBox.Show(backupPath.ToString());