Is Xml Name Char - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

Is Xml Name Char

Demo Code

// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.

public class Main{
        public static bool IsXmlNameChar(char chr)
        {/*from w  w  w  .j  a v a  2 s. c om*/
            // [4a] NameChar     ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
            // http://www.w3.org/TR/REC-xml/#NT-Name
            return Char.IsDigit(chr) ||
                   IsXmlNameStartChar(chr) ||
                   chr == '-' ||
                   chr == '.' ||
                   chr == '?' || // (U+00B7 is middle dot: ?)
                   IsInRange(chr, 0x0300, 0x036F) ||
                   IsInRange(chr, 0x203F, 0x2040);
        }
}

Related Tutorials