The problem is that you do not have XML - you have a string that will probably look like XML, but, unfortunately, does not fit. Fortunately, you can tell XmlReader be softer:
using (XmlReader reader = XmlReader.Create(new StringReader(xml), new XmlReaderSettings { CheckCharacters = false })) { while (reader.Read()) {
Note that you will still get XML, which when serialized can lead to further problems, so you may want to filter out the characters after that anyway when you read it.
source share