System.Xml.XmlResolver Class

public abstract class XmlResolver

Base Types

Object
  XmlResolver

Assembly

System.Xml

Library

XML

Summary

Resolves external XML resources named by a URI.

Description

This class is used to resolve external XML resources such as entities, document type definitions (DTDs), or schemas. It is also used to process include and import elements found in Extensible StyleSheet Language (XSL) stylesheets or XML Schema Definition language (XSD) schemas.

This class is abstract and implemented in the XmlUrlResolver class.

See Also

System.Xml Namespace

Members

XmlResolver Constructors

XmlResolver Constructor

XmlResolver Methods

XmlResolver.GetEntity Method
XmlResolver.ResolveUri Method

XmlResolver Properties

XmlResolver.Credentials Property


XmlResolver Constructor

protected XmlResolver();

Summary

Constructs a new instance of the XmlResolver class.

See Also

System.Xml.XmlResolver Class, System.Xml Namespace

XmlResolver.GetEntity Method

public abstract object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn);

Summary

Maps a URI to an object containing the actual resource that the URI represents.

Parameters

absoluteUri
An instance of the Uri class containing an absolute URI.
role
A String containing the xlink:role, or used as an implementation specific argument in other scenarios.
ofObjectToReturn
The type of object to return.

Return Value

A Object containing the resource.

Exceptions

Exception TypeCondition
ArgumentNullExceptionabsoluteUri is null .
XmlExceptionofObjectToReturn is not a supported type.

Description

[Behaviors: As described above. ]

[Overrides: At a minimum, supporting the return of a Stream object is required. ]

See Also

System.Xml.XmlResolver Class, System.Xml Namespace

XmlResolver.ResolveUri Method

public abstract Uri ResolveUri(Uri baseUri, string relativeUri);

Summary

Resolves the absolute URI from the base and relative URIs.

Parameters

baseUri
The Uri specifying the base URI used to resolve relativeURI.
relativeUri
A String specifying the URI to resolve. The URI can be absolute or relative.

Return Value

A Uri containing the absolute URI, or null if relativeUri can not be resolved.

Exceptions

Exception TypeCondition
XmlExceptionbaseUri and relativeUri are null .

Description

[Behaviors: As described above. ]

[Overrides: This method must be overridden in order to provide the functionality described above, as there is no default implementation. ]

See Also

System.Xml.XmlResolver Class, System.Xml Namespace

XmlResolver.Credentials Property

public abstract ICredentials Credentials { set; }

Summary

Sets the credentials used to authenticate Web requests.

Property Value

A ICredentials instance containing the credentials.

Description

[Behaviors: This property sets the credentials used to authenticate Web requests. If the virtual directory is configured to allow anonymous access, this property does not need to be set. Otherwise, the credentials of the user must be supplied. If credentials are needed but not supplied, the XmlResolver class uses default credentials (System.Net.CredentialCache.DefaultCredentials).

This property is write-only.

]

[Overrides: This property must be overridden in order to provide the functionality described above, as there is no default implementation. ]

Example

See System.Xml.XmlUrlResolver.Credentials for an example using this property.

See Also

System.Xml.XmlResolver Class, System.Xml Namespace