System.Xml.Schema.XdrValidator.LoadSchemaFromLocation C# (CSharp) Method

LoadSchemaFromLocation() private method

private LoadSchemaFromLocation ( string uri ) : void
uri string
return void
        private void LoadSchemaFromLocation(string uri) {
            // is x-schema
            if (!XdrBuilder.IsXdrSchema(uri)) {
                return;
            }
            string url = uri.Substring(x_schema.Length);
            XmlReader reader = null;
            SchemaInfo xdrSchema = null;
            try {
                Uri ruri = this.XmlResolver.ResolveUri(BaseUri, url);
                Stream stm = (Stream)this.XmlResolver.GetEntity(ruri,null,null);
                reader = new XmlTextReader(ruri.ToString(), stm, NameTable);
                ((XmlTextReader)reader).XmlResolver = this.XmlResolver;
                Parser parser = new Parser(SchemaType.XDR, NameTable, SchemaNames, EventHandler);
                parser.XmlResolver = this.XmlResolver;
                parser.Parse(reader, uri);
                while(reader.Read());// wellformness check
                xdrSchema = parser.XdrSchema;
            }
            catch(XmlSchemaException e) {
                SendValidationEvent(Res.Sch_CannotLoadSchema, new string[] {uri, e.Message}, XmlSeverityType.Error);
            }
            catch(Exception e) {
                SendValidationEvent(Res.Sch_CannotLoadSchema, new string[] {uri, e.Message}, XmlSeverityType.Warning);
            }
            finally {
                if (reader != null) {
                    reader.Close();
                }
            }
            if (xdrSchema != null && xdrSchema.ErrorCount == 0) {
                schemaInfo.Add(xdrSchema, EventHandler);
                SchemaCollection.Add(uri, xdrSchema, null, false);
            }
        }