Answers for "c# get value of xml tag"

C#
0

get attribute value of xml element c#

string name;
XmlDocument xml = new XmlDocument();
xml.Load("theFile.xml"); 
// Or any other method to load your xml data in the XmlDocument.
// For example if your xml data are in a string, use the LoadXml method.
XmlElement elt = xml.SelectSingleNode("//SubMenu[@id='STE']") as XmlElement;
if(elt!=null)
{
  name=elt.GetAttribute("name");  
}
Posted by: Guest on May-22-2020
0

c# read xml tag value

XmlNodeList nodeList=
(infodoc.SelectNodes("configuration/Settings/directory"));

foreach (XmlNode elem in nodeList)
{
string strValue = elem.Attributes[1].Value;

}
Posted by: Guest on October-31-2021

C# Answers by Framework

Browse Popular Code Answers by Language