Example #1
0
        // We decided not to support XDR schema; it is obsolete.
        public override bool Read()
        {
            if (validatingReader == null)
            {
                switch (ValidationType)
                {
                case ValidationType.Auto:
                case ValidationType.None:
                    goto case ValidationType.Schema;                     // might be specified by xsi:schemaLocation.

                case ValidationType.DTD:
                    validatingReader      = dtdReader = new DTDValidatingReader(sourceReader, this);
                    dtdReader.XmlResolver = Resolver;
                    break;

                case ValidationType.Schema:
                    dtdReader = new DTDValidatingReader(sourceReader, this);
                    XsdValidatingReader xsvr = new XsdValidatingReader(dtdReader);
                    xsvr.ValidationEventHandler +=
                        new ValidationEventHandler(
                            OnValidationEvent);
                    xsvr.ValidationType   = ValidationType;
                    xsvr.Schemas          = Schemas.SchemaSet;
                    xsvr.XmlResolver      = Resolver;
                    validatingReader      = xsvr;
                    dtdReader.XmlResolver = Resolver;
                    break;

                case ValidationType.XDR:
                    throw new NotSupportedException();
                }
                schemaInfo = validatingReader as IHasXmlSchemaInfo;
            }
            return(validatingReader.Read());
        }
Example #2
0
        public override bool Read()
        {
            if (this.validatingReader == null)
            {
                switch (this.ValidationType)
                {
                case ValidationType.None:
                case ValidationType.Auto:
                    break;

                case ValidationType.DTD:
                    this.validatingReader      = (this.dtdReader = new DTDValidatingReader(this.sourceReader, this));
                    this.dtdReader.XmlResolver = this.Resolver;
                    goto IL_F3;

                case ValidationType.XDR:
                    throw new NotSupportedException();

                case ValidationType.Schema:
                    break;

                default:
                    goto IL_F3;
                }
                this.dtdReader = new DTDValidatingReader(this.sourceReader, this);
                XsdValidatingReader xsdValidatingReader  = new XsdValidatingReader(this.dtdReader);
                XsdValidatingReader xsdValidatingReader2 = xsdValidatingReader;
                xsdValidatingReader2.ValidationEventHandler = (ValidationEventHandler)Delegate.Combine(xsdValidatingReader2.ValidationEventHandler, new ValidationEventHandler(this.OnValidationEvent));
                xsdValidatingReader.ValidationType          = this.ValidationType;
                xsdValidatingReader.Schemas     = this.Schemas.SchemaSet;
                xsdValidatingReader.XmlResolver = this.Resolver;
                this.validatingReader           = xsdValidatingReader;
                this.dtdReader.XmlResolver      = this.Resolver;
IL_F3:
                this.schemaInfo = (this.validatingReader as IHasXmlSchemaInfo);
            }
            return(this.validatingReader.Read());
        }
Example #3
0
		public XsdValidatingReader (XmlReader reader)
		{
			this.reader = reader;
			readerLineInfo = reader as IXmlLineInfo;
			sourceReaderSchemaInfo = reader as IHasXmlSchemaInfo;
			schemas.ValidationEventHandler += ValidationEventHandler;
		}
		// We decided not to support XDR schema; it is obsolete.
		public override bool Read ()
		{
			if (validatingReader == null) {
				switch (ValidationType) {
				case ValidationType.Auto:
				case ValidationType.None:
					goto case ValidationType.Schema; // might be specified by xsi:schemaLocation.
				case ValidationType.DTD:
					validatingReader = dtdReader = new DTDValidatingReader (sourceReader, this);
					dtdReader.XmlResolver = Resolver;
					break;
				case ValidationType.Schema:
					dtdReader = new DTDValidatingReader (sourceReader, this);
					XsdValidatingReader xsvr = new XsdValidatingReader (dtdReader);
					xsvr.ValidationEventHandler +=
						new ValidationEventHandler (
							OnValidationEvent);
					xsvr.ValidationType = ValidationType;
					xsvr.Schemas = Schemas.SchemaSet;
					xsvr.XmlResolver = Resolver;
					validatingReader = xsvr;
					dtdReader.XmlResolver = Resolver;
					break;
				case ValidationType.XDR:
					throw new NotSupportedException ();
				}
				schemaInfo = validatingReader as IHasXmlSchemaInfo;
			}
			return validatingReader.Read ();
		}