Mega Code Archive

 
Categories / C# / XML
 

Get Attribute Value

using System;     using System.Text;     using System.Xml; //GNU General Public License version 2 (GPLv2) //http://cbasetest.codeplex.com/license public class MainClass{         public static string GetAttributeValue(XmlNode xmlnd, string name)         {             return GetAttributeValue(xmlnd, name, string.Empty);         }         public static string GetAttributeValue(XmlNode xmlnd, string name, string sErr)         {             XmlAttribute attribute = xmlnd.Attributes[name];             if (attribute == null)             {                 return sErr;             }             return attribute.Value;         } }