XmlResolver.ResolveUri(Uri, String) 方法

定义

当在派生类中被重写时,从基 URI 和相对 URI 解析绝对 URI。When overridden in a derived class, resolves the absolute URI from the base and relative URIs.

public:
 virtual Uri ^ ResolveUri(Uri ^ baseUri, System::String ^ relativeUri);
public virtual Uri ResolveUri (Uri? baseUri, string? relativeUri);
public virtual Uri ResolveUri (Uri baseUri, string relativeUri);
abstract member ResolveUri : Uri * string -> Uri
override this.ResolveUri : Uri * string -> Uri
Public Overridable Function ResolveUri (baseUri As Uri, relativeUri As String) As Uri

参数

baseUri
Uri

用于解析相对 URI 的基 URI。The base URI used to resolve the relative URI.

relativeUri
String

要解析的 URI。The URI to resolve. URI 可以是绝对的或相对的。The URI can be absolute or relative. 如果是绝对的,此值有效地替换 baseUri 值。If absolute, this value effectively replaces the baseUri value. 如果是相对的,它与 baseUri 组合以构成绝对 URI。If relative, it combines with the baseUri to make an absolute URI.

返回

Uri

绝对 URI;如果不能解析相对 URI,则为 nullThe absolute URI or null if the relative URI cannot be resolved.

例外

relativeUrinullrelativeUri is null.

示例

XmlUrlResolver.GetEntity有关使用此方法的示例,请参阅。See XmlUrlResolver.GetEntity for an example that uses this method.

注解

绝对 URI 可用作与此 URI 相关的任何后续请求的基 URI。The absolute URI may be used as the base URI for any subsequent requests for entities that are relative to this URI.

适用于