Exemple #1
0
        public virtual bool CheckValidity(XmlSchemaSet schemas, ValidationEventHandler handler)
        {
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.NameTable = NameTable;
            settings.SetSchemas(schemas);
            settings.ValidationEventHandler += handler;
            settings.ValidationType          = ValidationType.Schema;
            try {
                XmlReader r = XmlReader.Create(
                    ReadSubtree(), settings);
                while (!r.EOF)
                {
                    r.Read();
                }
            } catch (XmlSchemaValidationException) {
                return(false);
            }
            return(true);
        }