System.Xml.Schema.XmlSchemaValidator.CheckAttributeValue C# (CSharp) 메소드

CheckAttributeValue() 개인적인 메소드

private CheckAttributeValue ( object value, SchemaAttDef attdef ) : object
value object
attdef SchemaAttDef
리턴 object
        private object CheckAttributeValue(object value, SchemaAttDef attdef)
        {
            object typedValue = null;
            SchemaDeclBase decl = attdef as SchemaDeclBase;

            XmlSchemaDatatype dtype = attdef.Datatype;
            Debug.Assert(dtype != null);
            string stringValue = value as string;
            Exception exception = null;

            if (stringValue != null)
            { //TODO: Combine both ParseValue with same signature in XmlSchemaDatatype
                exception = dtype.TryParseValue(stringValue, _nameTable, _nsResolver, out typedValue);
                if (exception != null) goto Error;
            }
            else
            { //Calling object ParseValue for checking facets
                exception = dtype.TryParseValue(value, _nameTable, _nsResolver, out typedValue);
                if (exception != null) goto Error;
            }
            if (!decl.CheckValue(typedValue))
            {
                _attrValid = false;
                SendValidationEvent(SR.Sch_FixedAttributeValue, attdef.Name.ToString());
            }
            return typedValue;

        Error:
            _attrValid = false;
            if (stringValue == null)
            {
                stringValue = XmlSchemaDatatype.ConcatenatedToString(value);
            }
            SendValidationEvent(SR.Sch_AttributeValueDataTypeDetailed, new string[] { attdef.Name.ToString(), stringValue, GetTypeName(decl), exception.Message }, exception);
            return null;
        }