System.Xml.Schema.XmlSchemaValidator.CheckMixedValueConstraint C# (CSharp) Méthode

CheckMixedValueConstraint() private méthode

private CheckMixedValueConstraint ( string elementValue ) : object
elementValue string
Résultat object
        internal object CheckMixedValueConstraint(string elementValue)
        {
            SchemaElementDecl elementDecl = _context.ElementDecl;
            Debug.Assert(elementDecl.ContentValidator.ContentType == XmlSchemaContentType.Mixed && elementDecl.DefaultValueTyped != null);
            if (_context.IsNill)
            { //Nil and fixed is error; Nil and default is compile time error
                return null;
            }
            if (elementValue.Length == 0)
            {
                _context.IsDefault = true;
                return elementDecl.DefaultValueTyped;
            }
            else
            {
                SchemaDeclBase decl = elementDecl as SchemaDeclBase;
                Debug.Assert(decl != null);
                if (decl.Presence == SchemaDeclBase.Use.Fixed && !elementValue.Equals(elementDecl.DefaultValueRaw))
                { //check string equality for mixed as it is untyped.
                    SendValidationEvent(SR.Sch_FixedElementValue, elementDecl.Name.ToString());
                }
                return elementValue;
            }
        }