Get Value Or Inner Text from XmlNode - CSharp System.Xml

CSharp examples for System.Xml:XML Node

Description

Get Value Or Inner Text from XmlNode

Demo Code


using System.Xml;
using System;//from   w  ww  . j a  v a 2s  .co  m

public class Main{
        public static string GetValueOrInnerText(XmlNode node)
      {
         XmlAttribute attr = node.Attributes["value"];
         if (attr!=null)
            return attr.InnerText;
         return node.InnerText;
      }
}

Related Tutorials