Exemplo n.º 1
0
        public static string VerifyTOKEN(string token)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }

            if (token.Length == 0)
            {
                return(token);
            }

            if (XmlChar.IsWhitespace(token [0]) ||
                XmlChar.IsWhitespace(token [token.Length - 1]))
            {
                throw new XmlException("Whitespace characters (#xA, #xD, #x9, #x20) are not allowed as leading or trailing whitespaces of xs:token.");
            }

            for (int i = 0; i < token.Length; i++)
            {
                if (XmlChar.IsWhitespace(token [i]) && token [i] != ' ')
                {
                    throw new XmlException("Either #xA, #xD or #x9 are not allowed inside xs:token.");
                }
            }

            return(token);
        }
Exemplo n.º 2
0
 public static string VerifyWhitespace(string content)
 {
     if (content == null)
     {
         throw new ArgumentNullException("content");
     }
     if (XmlChar.IsWhitespace(content))
     {
         return(content);
     }
     throw new XmlException(string.Format("'{0}' is not whitespace", content));
 }
Exemplo n.º 3
0
 public static bool IsWhitespaceChar(char ch)
 {
     return(XmlChar.IsWhitespace(ch));
 }