/// <summary> /// Whether a given character is allowed by XML 1.0. /// </summary> public static bool IsLegalXmlChar(int character) { return ( character == 0x9 /* == '\t' == 9 */ || character == 0xA /* == '\n' == 10 */ || character == 0xD /* == '\r' == 13 */ || (character >= 0x20 && character <= 0xD7FF) || (character >= 0xE000 && character <= 0xFFFD) || (character >= 0x10000 && character <= 0x10FFFF) ); }原文链接:https://www.f2er.com/xml/297576.html