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

ValidateEndOfAttributes() public méthode

public ValidateEndOfAttributes ( XmlSchemaInfo schemaInfo ) : void
schemaInfo XmlSchemaInfo
Résultat void
        public void ValidateEndOfAttributes(XmlSchemaInfo schemaInfo)
        {
            CheckStateTransition(ValidatorState.EndOfAttributes, s_methodNames[(int)ValidatorState.EndOfAttributes]);
            //Check required attributes
            SchemaElementDecl currentElementDecl = _context.ElementDecl;
            if (currentElementDecl != null && currentElementDecl.HasRequiredAttribute)
            {
                _context.CheckRequiredAttribute = false;
                CheckRequiredAttributes(currentElementDecl);
            }
            if (schemaInfo != null)
            { //set validity depending on whether all required attributes were validated successfully
                schemaInfo.Validity = _context.Validity;
            }
        }

Usage Example

Exemple #1
0
        public void DefaultValueForXmlResolver_XmlUrlResolver()
        {
            XmlNamespaceManager manager = new XmlNamespaceManager(new NameTable());

            manager.AddNamespace("t", "uri:tempuri");

            XmlSchemaValidator val = new XmlSchemaValidator(new NameTable(),
                                                            CreateSchemaSetFromXml("<root />"),
                                                            manager,
                                                            AllFlags);
            XmlSchemaInfo info = new XmlSchemaInfo();

            val.XmlResolver = new XmlUrlResolver(); //Adding this as the default resolver is null and not XmlUrlResolver anymore

            val.Initialize();
            val.ValidateElement("foo", "", null, "t:type1", null, "uri:tempuri " + TestData + XSDFILE_TARGET_NAMESPACE, null);
            val.ValidateEndOfAttributes(null);
            val.ValidateElement("bar", "", null);
            val.ValidateEndOfAttributes(null);
            val.ValidateEndElement(null);
            val.ValidateEndElement(info);

            Assert.Equal(info.ContentType, XmlSchemaContentType.ElementOnly);
            Assert.True(info.SchemaType != null);

            return;
        }
All Usage Examples Of System.Xml.Schema.XmlSchemaValidator::ValidateEndOfAttributes