CSharp examples for System.Xml:XML String
Read Single Node from XML String
using System.Xml; using System.Collections.Generic; public class Main{ public static string ReadSingleNode(this string xml, string nodeXPath) {//from w w w . ja v a 2 s .co m XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xml); XmlNode node = xmlDocument.SelectSingleNode(nodeXPath); return (node == null) ? string.Empty : node.InnerText; } }