CSharp examples for System.Xml:XML Node
Get XML Child Node Text
using System.Xml; using System;//from w w w . j a v a2 s .co m public class Main{ public static string ChildNodeText(XmlNode node, string tag, string defaultValue) { XmlNode childNode = node.SelectSingleNode(tag); return childNode != null ? childNode.InnerText : defaultValue; } public static string ChildNodeText(XmlNode node, string tag) { var childNode = node.SelectSingleNode(tag); return childNode==null?string.Empty:childNode.InnerText; } }