System.Xml.Tests.TCAddSchema.SetIgnoreInlineSchemaFlag_AddSchemaShouldDoNothing C# (CSharp) Méthode

SetIgnoreInlineSchemaFlag_AddSchemaShouldDoNothing() private méthode

private SetIgnoreInlineSchemaFlag_AddSchemaShouldDoNothing ( ) : void
Résultat void
        public void SetIgnoreInlineSchemaFlag_AddSchemaShouldDoNothing()
        {
            XmlSchemaValidator val;
            XmlSchemaInfo info = new XmlSchemaInfo();

            val = CreateValidator(CreateSchemaSetFromXml("<root />"), XmlSchemaValidationFlags.ReportValidationWarnings | XmlSchemaValidationFlags.ProcessSchemaLocation);

            val.AddSchema(XmlSchema.Read(XmlReader.Create(new StringReader("<?xml version=\"1.0\" ?>\n" +
                                                                           "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" +
                                                                           "    <xs:element name=\"foo\" type=\"xs:string\" />\n" +
                                                                           "</xs:schema>")), null));

            val.Initialize();

            try
            {
                val.ValidateElement("foo", "", info);
                throw new Exception("Additional schema was loaded!");
            }
            catch (XmlSchemaValidationException)
            {
                return;
            }
        }
    }