Beispiel #1
0
 public static bool IsNmToken(string str)
 {
     if (str.Length == 0)
     {
         return(false);
     }
     for (int i = 0; i < str.Length; i++)
     {
         if (!XmlChar.IsNameChar((int)str[i]))
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #2
0
        internal static bool IsInvalid(char c, bool firstOnlyLetter)
        {
            if (c == ':')             // Special case. allowed in EncodeName, but encoded in EncodeLocalName
            {
                return(false);
            }

            if (firstOnlyLetter)
            {
                return(!XmlChar.IsFirstNameChar(c));
            }
            else
            {
                return(!XmlChar.IsNameChar(c));
            }
        }
Beispiel #3
0
 public static bool IsName(string str)
 {
     if (str.Length == 0)
     {
         return(false);
     }
     if (!XmlChar.IsFirstNameChar((int)str[0]))
     {
         return(false);
     }
     for (int i = 1; i < str.Length; i++)
     {
         if (!XmlChar.IsNameChar((int)str[i]))
         {
             return(false);
         }
     }
     return(true);
 }