public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) { CacheEntry ce = cache.FindSchemaByUri(absoluteUri); if (ce != null && ce.HasUpToDateSchema) { return(ce.Schema); } Stream stm = base.GetEntity(absoluteUri, role, typeof(Stream)) as Stream; using (stm) { if (stm != null) { XmlSchema s = XmlSchema.Read(stm, handler); s.SourceUri = absoluteUri.AbsoluteUri; if (ce != null) { ce.Schema = s; } else { cache.Add(s); } return(s); } } return(null); }
public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) { CacheEntry ce = cache.FindSchemaByUri(absoluteUri); if (ce != null && ce.HasUpToDateSchema) { return(ce.Schema); } XmlSchema s = null; if (ofObjectToReturn == typeof(XmlSchema)) { XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationEventHandler += handler; settings.XmlResolver = this; XmlReader r = XmlReader.Create(absoluteUri.AbsoluteUri, settings); if (r != null) { s = XmlSchema.Read(r, handler); if (s != null) { s.SourceUri = absoluteUri.AbsoluteUri; if (ce != null) { ce.Schema = s; } else { cache.Add(s); } return(s); } } } else { return(base.GetEntity(absoluteUri, role, typeof(Stream)) as Stream); } return(null); }