public static WebReferenceOptions Read(XmlReader xmlReader, ValidationEventHandler validationEventHandler)
 {
     WebReferenceOptions options;
     XmlValidatingReader reader = new XmlValidatingReader(xmlReader) {
         ValidationType = ValidationType.Schema
     };
     if (validationEventHandler != null)
     {
         reader.ValidationEventHandler += validationEventHandler;
     }
     else
     {
         reader.ValidationEventHandler += new ValidationEventHandler(WebReferenceOptions.SchemaValidationHandler);
     }
     reader.Schemas.Add(Schema);
     webReferenceOptionsSerializer serializer = new webReferenceOptionsSerializer();
     try
     {
         options = (WebReferenceOptions) serializer.Deserialize(reader);
     }
     catch (Exception exception)
     {
         throw exception;
     }
     finally
     {
         reader.Close();
     }
     return options;
 }
        /// <include file='doc\WebReferenceOptions.uex' path='docs/doc[@for="XmlSchema.Read2"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public static WebReferenceOptions Read(XmlReader xmlReader, ValidationEventHandler validationEventHandler)
        {
            XmlValidatingReader validatingReader = new XmlValidatingReader(xmlReader);

            validatingReader.ValidationType = ValidationType.Schema;
            if (validationEventHandler != null)
            {
                validatingReader.ValidationEventHandler += validationEventHandler;
            }
            else
            {
                validatingReader.ValidationEventHandler += new ValidationEventHandler(SchemaValidationHandler);
            }
            validatingReader.Schemas.Add(Schema);
            webReferenceOptionsSerializer ser = new webReferenceOptionsSerializer();

            try {
                return((WebReferenceOptions)ser.Deserialize(validatingReader));
            }
            catch (Exception e) {
                throw e;
            }
            finally {
                validatingReader.Close();
            }
        }
Пример #3
0
        public static WebReferenceOptions Read(XmlReader xmlReader, ValidationEventHandler validationEventHandler)
        {
            WebReferenceOptions options;
            XmlValidatingReader reader = new XmlValidatingReader(xmlReader)
            {
                ValidationType = ValidationType.Schema
            };

            if (validationEventHandler != null)
            {
                reader.ValidationEventHandler += validationEventHandler;
            }
            else
            {
                reader.ValidationEventHandler += new ValidationEventHandler(WebReferenceOptions.SchemaValidationHandler);
            }
            reader.Schemas.Add(Schema);
            webReferenceOptionsSerializer serializer = new webReferenceOptionsSerializer();

            try
            {
                options = (WebReferenceOptions)serializer.Deserialize(reader);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                reader.Close();
            }
            return(options);
        }
 /// <include file='doc\WebReferenceOptions.uex' path='docs/doc[@for="XmlSchema.Read2"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public static WebReferenceOptions Read(XmlReader xmlReader, ValidationEventHandler validationEventHandler) {
     XmlValidatingReader validatingReader = new XmlValidatingReader(xmlReader);
     validatingReader.ValidationType = ValidationType.Schema;
     if (validationEventHandler != null) {
         validatingReader.ValidationEventHandler += validationEventHandler;
     }
     else {
         validatingReader.ValidationEventHandler += new ValidationEventHandler(SchemaValidationHandler);
     }
     validatingReader.Schemas.Add(Schema);
     webReferenceOptionsSerializer ser = new webReferenceOptionsSerializer();
     try {
         return (WebReferenceOptions)ser.Deserialize(validatingReader);
     }
     catch (Exception e) {
         throw e;
     }
     finally {
         validatingReader.Close();
     }
 }