You don't have a valid XML document; if you find most (or all) of your input is like this you can easily wrap the content in dummy tags to ensure that the parsers will not fail (assuming the inner node content is valid when it's the content of another XML element), like so:
<root>
hi hello <bbb name='ahhahdch'>MR.JKROY</bbb>.how are you.Let's meet
<bbb name='bbcbc'>SUSANNE</bbb>. Our team lead is <bbb name='cdcdcd'>JACK</bbb>, from .net.
</root>
Once you have a valid XML document, you can then use the XmlDocument
class to parse the content and then get the text with the elements removed using the InnerText
property:
string xml = <content from above>;
var doc = new XmlDocument();
doc.LoadXml(xml);
// Gives you only the text.
Console.WriteLine(doc.InnerText);
Or use the XDocument
class and then get the text from the Value
property on the XElement
exposed by the Root
property on XDocument
:
XDocument doc = XDocument.Parse(xml);
// Gives you only the text.
Console.WriteLine(doc.Root.Value);