I am getting exception
\'\', hexadecimal value 0x0B, is an invalid character. Line 23, position 22.
I have already tri
You can replace these invalid characters using the below method.
public static string CleanInvalidXmlChars(this string StrInput)
{
//Returns same value if the value is empty.
if (string.IsNullOrWhiteSpace(StrInput))
{
return StrInput;
}
// From xml spec valid chars:
// #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
// any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
string RegularExp = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
return Regex.Replace(StrInput, RegularExp, String.Empty);
}