Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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");  
}
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #attribute #xml #element
ADD COMMENT
Topic
Name
3+7 =