System.Xml.XmlConvert.VerifyNMTOKEN C# (CSharp) Method

VerifyNMTOKEN() static private method

static private VerifyNMTOKEN ( string name, ExceptionType exceptionType ) : string
name string
exceptionType ExceptionType
return string
        internal static string VerifyNMTOKEN(string name, ExceptionType exceptionType)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (name.Length == 0)
            {
                throw CreateException(SR.Xml_InvalidNmToken, name, exceptionType);
            }

            int endPos = ValidateNames.ParseNmtokenNoNamespaces(name, 0);

            if (endPos != name.Length)
            {
                throw CreateException(SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(name, endPos), exceptionType, 0, endPos + 1);
            }
            return name;
        }

Same methods

XmlConvert::VerifyNMTOKEN ( string name ) : string

Usage Example

Esempio n. 1
0
 public virtual Task WriteNmTokenAsync(string name)
 {
     if (name == null || name.Length == 0)
     {
         throw new ArgumentException(SR.Xml_EmptyName);
     }
     return(WriteStringAsync(XmlConvert.VerifyNMTOKEN(name, ExceptionType.ArgumentException)));
 }
All Usage Examples Of System.Xml.XmlConvert::VerifyNMTOKEN