Example #1
0
        public static bool IsNCName(string str)
        {
            if (str == null)
            {
                return(false);
            }
            else
            {
                int len = str.Length;
                switch (len)
                {
                case 0:
                    return(false);

                case 1:
                    return(NCName.IsNCNameStart(str[0]));

                default:
                    if (!NCName.IsNCNameStart(str[0]))
                    {
                        return(false);
                    }
                    for (int i = 1; i < len; i++)
                    {
                        if (!NCName.IsNCNameTrail(str[i]))
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
            }
        }