예제 #1
0
 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);
 }
예제 #2
0
 private void SetupValidation(System.Xml.ValidationType valType)
 {
     this.validator = BaseValidator.CreateInstance(valType, this, this.schemaCollection, this.eventHandling, this.processIdentityConstraints);
     System.Xml.XmlResolver resolver = this.GetResolver();
     this.validator.XmlResolver = resolver;
     if (this.outerReader.BaseURI.Length > 0)
     {
         this.validator.BaseUri = (resolver == null) ? new Uri(this.outerReader.BaseURI, UriKind.RelativeOrAbsolute) : resolver.ResolveUri(null, this.outerReader.BaseURI);
     }
     this.coreReaderImpl.ValidationEventHandling = (this.validationType == System.Xml.ValidationType.None) ? null : this.eventHandling;
 }
예제 #3
0
 private void Initialize()
 {
     this.nameTable                 = null;
     this.xmlResolver               = this.CreateDefaultResolver();
     this.lineNumberOffset          = 0;
     this.linePositionOffset        = 0;
     this.checkCharacters           = true;
     this.conformanceLevel          = System.Xml.ConformanceLevel.Document;
     this.ignoreWhitespace          = false;
     this.ignorePIs                 = false;
     this.ignoreComments            = false;
     this.dtdProcessing             = System.Xml.DtdProcessing.Prohibit;
     this.closeInput                = false;
     this.maxCharactersFromEntities = 0L;
     this.maxCharactersInDocument   = 0L;
     this.schemas          = null;
     this.validationType   = System.Xml.ValidationType.None;
     this.validationFlags  = XmlSchemaValidationFlags.ProcessIdentityConstraints;
     this.validationFlags |= XmlSchemaValidationFlags.AllowXmlAttributes;
     this.isReadOnly       = false;
 }
 private void Initialize()
 {
     this.nameTable = null;
     this.xmlResolver = this.CreateDefaultResolver();
     this.lineNumberOffset = 0;
     this.linePositionOffset = 0;
     this.checkCharacters = true;
     this.conformanceLevel = System.Xml.ConformanceLevel.Document;
     this.ignoreWhitespace = false;
     this.ignorePIs = false;
     this.ignoreComments = false;
     this.dtdProcessing = System.Xml.DtdProcessing.Prohibit;
     this.closeInput = false;
     this.maxCharactersFromEntities = 0L;
     this.maxCharactersInDocument = 0L;
     this.schemas = null;
     this.validationType = System.Xml.ValidationType.None;
     this.validationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
     this.validationFlags |= XmlSchemaValidationFlags.AllowXmlAttributes;
     this.isReadOnly = false;
 }