Mega Code Archive

 
Categories / C# / XML
 

Get Int value from xml attribute

//Microsoft Public License (Ms-PL) //http://dbmlmanager.codeplex.com/license #region using using System; using System.Xml; #endregion namespace DbmlManager.Lib.Utility {   #region Class Docs   /// <summary>   /// Summary description for XmlUtil.   /// </summary>   #endregion   public class XmlUtil   {     #region GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)     public static void GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)     {       if (node.Attributes == null || node.Attributes[name] == null)       {         found = false;         valid = false;         return;       }       found = true;       valid = Int32.TryParse(node.Attributes[name].InnerText, out result);     }     #endregion   } }