コード例 #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());
        }
コード例 #2
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 ();
		}