示例#1
0
        // Determine if a string is a valid XML name.
        public static bool IsName(String name)
        {
            int posn;

            if (((Object)name) == null || name.Length == 0)
            {
                return(false);
            }
            else if (!XmlConvert.IsNameStart(name[0], true))
            {
                return(false);
            }
            for (posn = 1; posn < name.Length; ++posn)
            {
                if (!XmlConvert.IsNameNonStart(name[posn], true))
                {
                    return(false);
                }
            }
            return(true);
        }