Sets the XmlResolver used to access external documents.
Assembly: System.Xml (in System.Xml.dll)
The XmlResolver is used to locate and open an XML instance document, or to locate and open any external resources referenced by the XML instance document. This can include entities, DTD, or schemas. The XmlResolver.Credentials property can be used to specify any credentials required for network authentication.
Because the can contain sensitive information such as user credentials, you should be careful when caching XmlReaderSettings objects, or when passing the XmlReaderSettings object from one component to another.
An XmlSecureResolver can be used to access external documents. The XmlSecureResolver class helps to secure another implementation of XmlResolver by wrapping the XmlResolver object and restricting the resources that the underlying XmlResolver has access to. For more information, see How to: Use the XmlSecureResolver Class.
The ProcessInlineSchema and ProcessSchemaLocation validation flags of an XmlReaderSettings object are not set by default. When these flags are set, the of the XmlReaderSettings object is used to resolve schema locations encountered in the instance document in the XmlReader. If the object is null, schema locations are not resolved even if the ProcessInlineSchema and ProcessSchemaLocation validation flags are set.
Schemas added during validation add new types and can change the validation outcome of the document being validated. As a result, external schemas should only be resolved from trusted sources.
// Create an XmlSecureResolver with default credentials. XmlSecureResolver myResolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/"); myResolver.Credentials = CredentialCache.DefaultCredentials; XmlReaderSettings settings = new XmlReaderSettings(); settings.XmlResolver = myResolver; // Create the reader. XmlReader reader = XmlReader.Create("http://serverName/data/books.xml", settings);
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.