How to stop XMLReader throwing Invalid XML Character Exception
问题 So I have some XML: <key>my tag</key><value>my tag value and my invalid Character</Value> and an XMLReader: using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { while (reader.Read()) { //do my thing } } I have implemented the CleanInvalidCharacters method from here but as the "" is not yet encoded it doesn't get removed. The error is being thrown at the reader.Read(); line with exception: hexadecimal value 0x0B, is an invalid character. 回答1: The problem is that you