//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 description for XmlUtil.
///
#endregion
public class XmlUtil
{
#region GetAttrib(XmlNode node, string attrib, string defVal)
public static string GetAttrib(XmlNode node, string attrib, string defVal)
{
XmlAttribute xmlAttrib = node.Attributes[attrib];
if (xmlAttrib == null)
return defVal;
string val = xmlAttrib.Value;
return (val == null) ? defVal : val;
}
#endregion
#region GetInt64Attrib(XmlNode node, string attrib, Int64 defVal)
public static Int64 GetInt64Attrib(XmlNode node, string attrib, Int64 defVal)
{
XmlAttribute xmlAttrib = node.Attributes[attrib];
if (xmlAttrib == null)
return defVal;
string val = xmlAttrib.Value;
if (val == null || val == string.Empty)
return defVal;
Int64 returnVal = defVal;
Int64.TryParse(val, out returnVal);
return returnVal;
}
#endregion
}
}