Is Legal Xml Char - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

Is Legal Xml Char

Demo Code


using System.Linq;
using System.Text;
using System.Collections.Generic;
using System;/* w w  w .j  av a2 s.  com*/

public class Main{
        private static bool IsLegalXmlChar(int character)
        {
            return
            (
                 character == 0x9 /* == '\t' == 9   */          ||
                 character == 0xA /* == '\n' == 10  */          ||
                 character == 0xD /* == '\r' == 13  */          ||
                (character >= 0x20 && character <= 0x7E)        ||
                 character == 0x85                              ||
                (character >= 0x100 && character <= 0xD7FF)     ||
                (character >= 0xE000 && character <= 0xFFFD)    ||
                 character >= 0x10000
            );
        }
}

Related Tutorials