System.Xml.Schema.SchemaCollectionPreprocessor.ValidateNameAttribute C# (CSharp) Method

ValidateNameAttribute() private method

private ValidateNameAttribute ( XmlSchemaObject xso ) : void
xso XmlSchemaObject
return void
        private void ValidateNameAttribute(XmlSchemaObject xso) {
            string name = xso.NameAttribute;
            if (name == null || name.Length == 0) {
                SendValidationEvent(Res.Sch_InvalidNameAttributeEx, null, Res.GetString(Res.Sch_NullValue), xso);
            }
            //Normalize whitespace since NCName has whitespace facet="collapse"
            name = XmlComplianceUtil.NonCDataNormalize(name);
            int len = ValidateNames.ParseNCName(name, 0);
            if (len != name.Length) { // If the string is not a valid NCName, then throw or return false
                string innerStr = Res.GetString(Res.Xml_BadNameCharWithPos, XmlException.BuildCharExceptionStr(name[len])[0], XmlException.BuildCharExceptionStr(name[len])[1], len);
                SendValidationEvent(Res.Sch_InvalidNameAttributeEx, name, innerStr, xso);
            }
            else {
                xso.NameAttribute = NameTable.Add(name);
            }
        }