CSharp examples for System.Xml:XML Node
Get XML Node Value via XPath
using System.Xml; using System;// ww w . j av a2 s .com public class Main{ public static string GetNodeValue(XmlNode xmlNode, string searchPath) { try { if (xmlNode != null) { var selectSingleNode = xmlNode.SelectSingleNode(searchPath); if (selectSingleNode != null) return selectSingleNode.InnerText; } return string.Empty; } catch (Exception) { return string.Empty; } } }