This documentation is archived and is not being maintained.

XmlResolver.GetEntity Method

When overridden in a derived class, maps a URI to an object containing the actual resource.

[Visual Basic]
Public MustOverride Function GetEntity( _
   ByVal absoluteUri As Uri, _
   ByVal role As String, _
   ByVal ofObjectToReturn As Type _
) As Object
public abstract object GetEntity(
 Uri absoluteUri,
 string role,
 Type ofObjectToReturn
public: virtual Object* GetEntity(
 Uri* absoluteUri,
 String* role,
 Type* ofObjectToReturn
) = 0;
public abstract function GetEntity(
   absoluteUri : Uri,
 role : String,
 ofObjectToReturn : Type
) : Object;


The URI returned from ResolveUri
The current version does not use this parameter when resolving URIs. This is provided for future extensibility purposes. For example, this can be mapped to the xlink:role and used as an implementation specific argument in other scenarios.
The type of object to return. The current version only returns System.IO.Stream objects.

Return Value

A System.IO.Stream object or a null reference (Nothing in Visual Basic) if a type other than stream is specified.


Exception Type Condition
XmlException ofObjectToReturn is neither a null reference (Nothing in Visual Basic) nor a Stream type.
UriFormatException The specified URI is not an absolute URI.
NullReferenceException absoluteUri is a null reference (Nothing in Visual Basic).
Exception There is a runtime error (for example, an interrupted server connection).


This method is used when the caller wants to map a given URI into the object containing the actual resource that the URI represents. The type of object returned is negotiable however the implementation must always support System.IO.Stream.


See XmlUrlResolver.GetEntity for an example using this method.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

XmlResolver Class | XmlResolver Members | System.Xml Namespace