mscorlib(4.0.0.0) API with additions
XmlResolver.cs
1 using System.IO;
2 using System.Net;
4 
5 namespace System.Xml
6 {
8  public abstract class XmlResolver
9  {
12  public virtual ICredentials Credentials
13  {
14  set
15  {
16  }
17  }
18 
30  public abstract object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn);
31 
38  public virtual Uri ResolveUri(Uri baseUri, string relativeUri)
39  {
40  if (baseUri == null || (!baseUri.IsAbsoluteUri && baseUri.OriginalString.Length == 0))
41  {
42  Uri uri = new Uri(relativeUri, UriKind.RelativeOrAbsolute);
43  if (!uri.IsAbsoluteUri && uri.OriginalString.Length > 0)
44  {
45  uri = new Uri(Path.GetFullPath(relativeUri));
46  }
47  return uri;
48  }
49  if (relativeUri == null || relativeUri.Length == 0)
50  {
51  return baseUri;
52  }
53  if (!baseUri.IsAbsoluteUri)
54  {
55  throw new NotSupportedException(Res.GetString("Xml_RelativeUriNotSupported"));
56  }
57  return new Uri(baseUri, relativeUri);
58  }
59 
65  public virtual bool SupportsType(Uri absoluteUri, Type type)
66  {
67  if (absoluteUri == null)
68  {
69  throw new ArgumentNullException("absoluteUri");
70  }
71  if (type == null || type == typeof(Stream))
72  {
73  return true;
74  }
75  return false;
76  }
77 
83  public virtual Task<object> GetEntityAsync(Uri absoluteUri, string role, Type ofObjectToReturn)
84  {
85  throw new NotImplementedException();
86  }
87  }
88 }
UriKind
Defines the kinds of T:System.Uris for the M:System.Uri.IsWellFormedUriString(System....
Definition: UriKind.cs:5
virtual ICredentials Credentials
When overridden in a derived class, sets the credentials used to authenticate web requests.
Definition: XmlResolver.cs:13
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
abstract object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
When overridden in a derived class, maps a URI to an object that contains the actual resource.
Definition: __Canon.cs:3
Resolves external XML resources named by a Uniform Resource Identifier (URI).
Definition: XmlResolver.cs:8
virtual bool SupportsType(Uri absoluteUri, Type type)
Enables the resolver to return types other than T:System.IO.Stream.
Definition: XmlResolver.cs:65
bool IsAbsoluteUri
Gets whether the T:System.Uri instance is absolute.
Definition: Uri.cs:820
Provides the base authentication interface for retrieving credentials for Web client authentication.
Definition: ICredentials.cs:5
string OriginalString
Gets the original URI string that was passed to the T:System.Uri constructor.
Definition: Uri.cs:739
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
virtual Uri ResolveUri(Uri baseUri, string relativeUri)
When overridden in a derived class, resolves the absolute URI from the base and relative URIs.
Definition: XmlResolver.cs:38
static string GetFullPath(string path)
Returns the absolute path for the specified path string.
Definition: Path.cs:446
virtual Task< object > GetEntityAsync(Uri absoluteUri, string role, Type ofObjectToReturn)
Asynchronously maps a URI to an object that contains the actual resource.
Definition: XmlResolver.cs:83
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Definition: Uri.cs:19
The exception that is thrown when a requested method or operation is not implemented.
Performs operations on T:System.String instances that contain file or directory path information....
Definition: Path.cs:13
Represents an asynchronous operation that can return a value.
Definition: Task.cs:18
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....
Definition: Stream.cs:16