Udostępnij za pośrednictwem


Resolve External XML Resources Named by a URI

The XmlResolver is an abstract class that locates external XML resources that have been named by a URI. It is used to load XML documents, and to resolve external resources such as entities, DTDs or schemas, and import or include directives. The XmlResolver handles all aspects of negotiating the connection to the resources, including handling security credentials, opening the connection to the data source, and returning the resource in the form of a stream or other object type.

The .NET Framework includes two implementations of the XmlResolver class.

  • The XmlUrlResolver class is the default resolver for all classes in the System.Xml namespace. It supports the file:// and http:// protocols and requests from the WebRequest class. In many cases, if you do not specify an XmlResolver object that your application should use, an XmlUrlResolver object with no user credentials is used to access XML resources.

  • The XmlSecureResolver class helps to secure another XmlResolver object by wrapping the XmlResolver object and restricting the resources that the underlying XmlResolver has access to. For example, the XmlSecureResolver class can prohibit access to particular Internet sites or zones.

In This Section