CSharp examples for System.Xml:XML Element
Get Single XML Element Value
using System.Xml.Serialization; using System.IO;//from w ww. j ava2s.c o m using System.Xml; using System.Text.RegularExpressions; using System; public class Main{ public static string GetSingleElementValue(XmlDocument doc, string name, string defaultValue) { XmlElement element = GetSingleElement(doc, name); if (element == null) { return defaultValue; } else { return element.InnerText; } } public static string GetSingleElementValue(XmlDocument doc, string name) { return GetSingleElementValue(doc, name,string.Empty); } }