private void ValidateNCName(string ncname) { if (ncname.Length == 0) { throw new ArgumentException(SR.Xml_EmptyName); } int len = ValidateNames.ParseNCName(ncname, 0); if (len != ncname.Length) { throw new ArgumentException(string.Format(len == 0 ? SR.Xml_BadStartNameChar : SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(ncname, len))); } }
private void ValidateNCName(string ncname) { if (ncname.Length == 0) { throw new ArgumentException(Res.GetString("Xml_EmptyName")); } int invCharIndex = ValidateNames.ParseNCName(ncname, 0); if (invCharIndex != ncname.Length) { throw new ArgumentException(Res.GetString((invCharIndex == 0) ? "Xml_BadStartNameChar" : "Xml_BadNameChar", XmlException.BuildCharExceptionArgs(ncname, invCharIndex))); } }
private void ValidateNCName(string ncname) { if (ncname.Length == 0) { throw new ArgumentException(Res.GetString(Res.Xml_EmptyName)); } int len = ValidateNames.ParseNCName(ncname, 0); if (len != ncname.Length) { throw new ArgumentException(Res.GetString(len == 0 ? Res.Xml_BadStartNameChar : Res.Xml_BadNameChar, XmlException.BuildCharExceptionStr(ncname[len]))); } }
internal static string VerifyNCName(string name, ExceptionType exceptionType) { if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentNullException("name", SR.Xml_EmptyLocalName); } int end = ValidateNames.ParseNCName(name, 0); if (end != name.Length) { // If the string is not a valid NCName, then throw or return false throw CreateInvalidNameCharException(name, end, exceptionType); } return(name); }