Returns the InnerText value from a node or string.Empty if the node is null.
using System;
using System.Xml;
namespace Microsoft.SnippetLibrary
{
/// <summary>
/// Summary description for Util.
/// </summary>
publicclass Utility
{
/// <summary>
/// Returns the InnerText value from a node
/// or string.Empty if the node is null.
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
publicstatic string GetTextFromElement(XmlElement element)
{
if (element == null)
return string.Empty;
elsereturn element.InnerText;
}
}
}