Namespace: System.Xml
Provides a default implementation of the XmlResolver
abstract class that uses URIs to resolve external XML resources.
System.Object
System.Xml.XmlResolver
System.Xml.XmlUrlResolver
public sealed class XmlUrlResolver : XmlResolver
The XmlUrlResolver
class resolves URIs to resources. It is used by the XmlDocument
, XmlReader
, and XmlWriter
classes to load and save XML documents.
The XmlUrlResolver
class supports resolving URIs to local files, network resources, and embedded resources. It also supports resolving relative URIs to base URIs.
The XmlUrlResolver
class can be configured with a System.Net.ICredentials
object to provide credentials for accessing network resources.
XmlUrlResolver()
Initializes a new instance of the XmlUrlResolver
class.
public override object GetEntity(Uri absoluteUri, string role, Type? ofObjectToReturn)
Resolves the specified absoluteUri
to an object. role
and ofObjectToReturn
are reserved and must be null. If the absoluteUri
is null, GetEntity
returns null.
Returns: The object that represents the resource specified by absoluteUri
. If absoluteUri
is null, this method returns null.
public override Uri? ResolveUri(Uri? baseUri, string? relativeUri)
Resolves the specified relative URI into an absolute URI. baseUri
is the URI relative to which the relativeUri
is resolved.
Returns: The absolute Uri
. If relativeUri
is null, this method returns baseUri
.
public override System.Net.ICredentials? Credentials { get; set; }
Gets or sets the ICredentials
used to authenticate the request to the resource.