XML中是不能包含这些非法字符的

前端之家收集整理的这篇文章主要介绍了XML中是不能包含这些非法字符的前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。



   /// <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)
            );
        }

猜你在找的XML相关文章