internal static string TextOfInnerHtml(string input) { // Parsing it as XML and then extracting the value removes any markup. var doc = XElement.Parse("<doc>" + input + "</doc>"); return doc.Value; }