System.Xml.XPath.XPathNavigator.GetValidatingReader C# (CSharp) Method

GetValidatingReader() private method

private GetValidatingReader ( XmlReader reader, XmlSchemaSet schemas, ValidationEventHandler validationEvent, XmlSchemaType schemaType, XmlSchemaElement schemaElement, XmlSchemaAttribute schemaAttribute ) : XmlReader
reader XmlReader
schemas System.Xml.Schema.XmlSchemaSet
validationEvent ValidationEventHandler
schemaType System.Xml.Schema.XmlSchemaType
schemaElement System.Xml.Schema.XmlSchemaElement
schemaAttribute System.Xml.Schema.XmlSchemaAttribute
return XmlReader
        private XmlReader GetValidatingReader(XmlReader reader, XmlSchemaSet schemas, ValidationEventHandler validationEvent, XmlSchemaType schemaType, XmlSchemaElement schemaElement, XmlSchemaAttribute schemaAttribute)
        {
            if (schemaAttribute != null)
            {
                return schemaAttribute.Validate(reader, null, schemas, validationEvent);
            }
            else if (schemaElement != null)
            {
                return schemaElement.Validate(reader, null, schemas, validationEvent);
            }
            else if (schemaType != null)
            {
                return schemaType.Validate(reader, null, schemas, validationEvent);
            }
            Debug.Assert(schemas != null, "schemas != null");
            XmlReaderSettings readerSettings = new XmlReaderSettings();
            readerSettings.ConformanceLevel = ConformanceLevel.Auto;
            readerSettings.ValidationType = ValidationType.Schema;
            readerSettings.Schemas = schemas;
            readerSettings.ValidationEventHandler += validationEvent;
            return XmlReader.Create(reader, readerSettings);
        }