internal XmlValidatingReaderImpl(XmlReader reader, System.Xml.Schema.ValidationEventHandler settingsEventHandler, bool processIdentityConstraints) { this.parsingFunction = ParsingFunction.Init; this.outerReader = this; this.coreReader = reader; this.coreReaderImpl = reader as XmlTextReaderImpl; if (this.coreReaderImpl == null) { XmlTextReader reader2 = reader as XmlTextReader; if (reader2 != null) { this.coreReaderImpl = reader2.Impl; } } if (this.coreReaderImpl == null) { throw new ArgumentException(Res.GetString("Arg_ExpectingXmlTextReader"), "reader"); } this.coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; this.coreReaderNSResolver = reader as IXmlNamespaceResolver; this.processIdentityConstraints = processIdentityConstraints; this.schemaCollection = new XmlSchemaCollection(this.coreReader.NameTable); this.schemaCollection.XmlResolver = this.GetResolver(); this.eventHandling = new ValidationEventHandling(this); if (settingsEventHandler != null) { this.eventHandling.AddHandler(settingsEventHandler); } this.coreReaderImpl.ValidationEventHandling = this.eventHandling; this.coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(this.ValidateDefaultAttributeOnUse); this.validationType = System.Xml.ValidationType.DTD; this.SetupValidation(System.Xml.ValidationType.DTD); }
// Initializes a new instance of XmlValidatingReaderImpl class with the specified arguments. // This constructor is used when creating XmlValidatingReaderImpl reader via "XmlReader.Create(..)" internal XmlValidatingReaderImpl(XmlReader reader, ValidationEventHandler?settingsEventHandler, bool processIdentityConstraints) { XmlAsyncCheckReader?asyncCheckReader = reader as XmlAsyncCheckReader; if (asyncCheckReader != null) { reader = asyncCheckReader.CoreReader; } _outerReader = this; _coreReader = reader; _coreReaderImpl = (reader as XmlTextReaderImpl) !; if (_coreReaderImpl == null) { XmlTextReader?tr = reader as XmlTextReader; if (tr != null) { _coreReaderImpl = tr.Impl; } } if (_coreReaderImpl == null) { throw new ArgumentException(SR.Arg_ExpectingXmlTextReader, nameof(reader)); } _coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; _coreReaderNSResolver = reader as IXmlNamespaceResolver; _processIdentityConstraints = processIdentityConstraints; #pragma warning disable 618 _schemaCollection = new XmlSchemaCollection(_coreReader.NameTable); #pragma warning restore 618 _schemaCollection.XmlResolver = GetResolver(); _eventHandling = new ValidationEventHandling(this); if (settingsEventHandler != null) { _eventHandling.AddHandler(settingsEventHandler); } _coreReaderImpl.ValidationEventHandling = _eventHandling; _coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse); _validationType = ValidationType.DTD; SetupValidation(ValidationType.DTD); }
// Initializes a new instance of XmlValidatingReaderImpl class with the specified arguments. // This constructor is used when creating XmlValidatingReaderImpl reader via "XmlReader.Create(..)" internal XmlValidatingReaderImpl(XmlReader reader, ValidationEventHandler settingsEventHandler, bool processIdentityConstraints) { XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader; if (asyncCheckReader != null) { reader = asyncCheckReader.CoreReader; } outerReader = this; coreReader = reader; coreReaderImpl = reader as XmlTextReaderImpl; if (coreReaderImpl == null) { XmlTextReader tr = reader as XmlTextReader; if (tr != null) { coreReaderImpl = tr.Impl; } } if (coreReaderImpl == null) { throw new ArgumentException(Res.GetString(Res.Arg_ExpectingXmlTextReader), "reader"); } coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; coreReaderNSResolver = reader as IXmlNamespaceResolver; this.processIdentityConstraints = processIdentityConstraints; #pragma warning disable 618 schemaCollection = new XmlSchemaCollection(coreReader.NameTable); #pragma warning restore 618 schemaCollection.XmlResolver = GetResolver(); eventHandling = new ValidationEventHandling(this); if (settingsEventHandler != null) { eventHandling.AddHandler(settingsEventHandler); } coreReaderImpl.ValidationEventHandling = eventHandling; coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse); validationType = ValidationType.DTD; SetupValidation(ValidationType.DTD); }
// // Constructors // // Initializes a new instance of XmlValidatingReaderImpl class with the specified XmlReader. // This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader internal XmlValidatingReaderImpl(XmlReader reader) { XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader; if (asyncCheckReader != null) { reader = asyncCheckReader.CoreReader; } _outerReader = this; _coreReader = reader; _coreReaderNSResolver = reader as IXmlNamespaceResolver; _coreReaderImpl = reader as XmlTextReaderImpl; if (_coreReaderImpl == null) { XmlTextReader tr = reader as XmlTextReader; if (tr != null) { _coreReaderImpl = tr.Impl; } } if (_coreReaderImpl == null) { throw new ArgumentException(ResXml.Arg_ExpectingXmlTextReader, "reader"); } _coreReaderImpl.EntityHandling = EntityHandling.ExpandEntities; _coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; _processIdentityConstraints = true; #pragma warning disable 618 _schemaCollection = new XmlSchemaCollection(_coreReader.NameTable); _schemaCollection.XmlResolver = GetResolver(); _eventHandling = new ValidationEventHandling(this); _coreReaderImpl.ValidationEventHandling = _eventHandling; _coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse); _validationType = ValidationType.Auto; SetupValidation(ValidationType.Auto); #pragma warning restore 618 }
// Initializes a new instance of XmlValidatingReaderImpl class with the specified arguments. // This constructor is used when creating XmlValidatingReaderImpl reader via "XmlReader.Create(..)" internal XmlValidatingReaderImpl( XmlReader reader, ValidationEventHandler settingsEventHandler, bool processIdentityConstraints) { XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader; if (asyncCheckReader != null) { reader = asyncCheckReader.CoreReader; } outerReader = this; coreReader = reader; coreReaderImpl = reader as XmlTextReaderImpl; if ( coreReaderImpl == null ) { XmlTextReader tr = reader as XmlTextReader; if ( tr != null ) { coreReaderImpl = tr.Impl; } } if ( coreReaderImpl == null ) { throw new ArgumentException( Res.GetString( Res.Arg_ExpectingXmlTextReader ), "reader" ); } coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; coreReaderNSResolver = reader as IXmlNamespaceResolver; this.processIdentityConstraints = processIdentityConstraints; #pragma warning disable 618 schemaCollection = new XmlSchemaCollection( coreReader.NameTable ); #pragma warning restore 618 schemaCollection.XmlResolver = GetResolver(); eventHandling = new ValidationEventHandling(this); if (settingsEventHandler != null) { eventHandling.AddHandler(settingsEventHandler); } coreReaderImpl.ValidationEventHandling = eventHandling; coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse); validationType = ValidationType.DTD; SetupValidation( ValidationType.DTD ); }
// // Constructors // // Initializes a new instance of XmlValidatingReaderImpl class with the specified XmlReader. // This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader internal XmlValidatingReaderImpl(XmlReader reader) { XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader; if (asyncCheckReader != null) { reader = asyncCheckReader.CoreReader; } _outerReader = this; _coreReader = reader; _coreReaderNSResolver = reader as IXmlNamespaceResolver; _coreReaderImpl = reader as XmlTextReaderImpl; if (_coreReaderImpl == null) { XmlTextReader tr = reader as XmlTextReader; if (tr != null) { _coreReaderImpl = tr.Impl; } } if (_coreReaderImpl == null) { throw new ArgumentException(SR.Arg_ExpectingXmlTextReader, nameof(reader)); } _coreReaderImpl.EntityHandling = EntityHandling.ExpandEntities; _coreReaderImpl.XmlValidatingReaderCompatibilityMode = true; _processIdentityConstraints = true; #pragma warning disable 618 _schemaCollection = new XmlSchemaCollection(_coreReader.NameTable); _schemaCollection.XmlResolver = GetResolver(); _eventHandling = new ValidationEventHandling(this); _coreReaderImpl.ValidationEventHandling = _eventHandling; _coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse); _validationType = ValidationType.Auto; SetupValidation(ValidationType.Auto); #pragma warning restore 618 }