private void SetupValidator(XmlReaderSettings readerSettings, XmlReader reader, XmlSchemaObject partialValidationType) { validator = new XmlSchemaValidator(coreReaderNameTable, readerSettings.Schemas, thisNSResolver, readerSettings.ValidationFlags); validator.XmlResolver = this.xmlResolver; validator.SourceUri = XmlConvert.ToUri(reader.BaseURI); //Not using XmlResolver.ResolveUri as it checks for relative Uris,reader.BaseURI will be absolute file paths or string.Empty validator.ValidationEventSender = this; validator.ValidationEventHandler += readerSettings.GetEventHandler(); validator.LineInfoProvider = this.lineInfo; if (validator.ProcessSchemaHints) { validator.SchemaSet.ReaderSettings.DtdProcessing = readerSettings.DtdProcessing; } validator.SetDtdSchemaInfo(reader.DtdInfo); if (partialValidationType != null) { validator.Initialize(partialValidationType); } else { validator.Initialize(); } }