XML
System.Xml
[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]
1.0.5000.0
2.0.0.0
4.0.0.0
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
System.Xml.XmlResolver
XmlUrlResolver 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) style sheets or XML Schema definition language (XSD) schemas.
XmlUrlResolver is the default resolver for all classes in the namespace. It supports the file:// and http:// protocols and requests from the class.
objects can contain sensitive information such as user credentials. You should be careful when you cache objects and should not pass objects to an untrusted component.
Resolves external XML resources named by a Uniform Resource Identifier (URI).
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
Initializes a new instance of the class.
0
Property
4.0.0.0
System.Net.Cache.RequestCachePolicy
To be added.
To be added.
Gets or sets the cache policy for the underlying object.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.ICredentials
A instance containing the credentials.
The following example sets credentials for the virtual directory "http://localhost/bookstore/inventory.xml". There
is no
output from this example.
using System;
using System.Net;
using System.Xml;
public class App {
public static void Main() {
XmlTextReader xtReader =
new XmlTextReader("http://localhost/" +
"bookstore/inventory.xml");
NetworkCredential netCredential =
new NetworkCredential("username",
"password",
"domain");
XmlUrlResolver xResolver = new XmlUrlResolver();
xResolver.Credentials = netCredential;
xtReader.XmlResolver= xResolver;
}
}
The following example associates different credentials
with different URIs and adds the credentials to a credential cache. The
credentials can then be used to check authentication for different URIs
regardless of the original source of the XML. There is no output from this
example.
using System;
using System.Net;
using System.Xml;
public class App {
public static void Main() {
XmlTextReader xtReader =
new XmlTextReader("http://localhost/" +
"bookstore/inventory.xml");
NetworkCredential netCredential1 =
new NetworkCredential("username1",
"password1",
"domain1");
NetworkCredential netCredential2 =
new NetworkCredential("username2",
"password2",
"domain2");
CredentialCache credCache = new CredentialCache();
credCache.Add( new Uri("http://www.contoso.com/"),
"Basic",
netCredential1);
credCache.Add( new Uri("http://app.contoso.com/"),
"Basic",
netCredential2);
XmlUrlResolver xResolver = new XmlUrlResolver();
xResolver.Credentials = credCache;
xtReader.XmlResolver= xResolver;
}
}
If the virtual directory does not require authentication, this property does not need to be set. Otherwise, the credentials of the user must be supplied.
Different credentials can be associated with different URIs and added to a credential cache. The credentials can then be used to check authentication for different URIs, regardless of the original source of the XML.
The following C# code shows how to set the property to a credential cache.
NetworkCredential myCred = new NetworkCredential(UserName,SecurelyStoredPassword,Domain);
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri("http://www.contoso.com/"), "Basic", myCred);
myCache.Add(new Uri("http://app.contoso.com/"), "Basic", myCred);
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = myCache;
Sets credentials used to authenticate Web requests.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Object
is .
is not or ().
is .
This method is used when the caller wants to map a given URI into an object containing the actual resource that the URI represents.
For the asynchronous version of this method, see .
Your application can mitigate memory Denial of Service threats to the method by implementing IStream to limit the number of bytes read. This helps to guard against situations where malicious code attempts to pass an infinite stream of bytes to the method.
Maps a URI to an object containing the actual resource.
A object or null if a type other than stream is specified.
The URI returned from .
The current implementation 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 implementation only returns objects.
0
Method
4.0.0.0
System.Diagnostics.DebuggerStepThrough
System.Runtime.CompilerServices.AsyncStateMachine(typeof(System.Xml.XmlUrlResolver/<GetEntityAsync>c__async0))
System.Threading.Tasks.Task<System.Object>
To be added.
Asynchronously maps a URI to an object containing the actual resource.
A object or null if a type other than stream is specified.
The URI returned from .
The current implementation 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 implementation only returns objects.
Property
4.0.0.0
System.Net.IWebProxy
To be added.
To be added.
Gets or sets the network proxy for the underlying object.
Method
2.0.0.0
4.0.0.0
System.Uri
is .
The absolute URI can be used as the base URI for any subsequent requests for entities that are relative to this URI.
Resolves the absolute URI from the base and relative URIs.
A representing the absolute URI, or null if the relative URI cannot be resolved.
The base URI used to resolve the relative URI.
The URI to resolve. The URI can be absolute or relative. If absolute, this value effectively replaces the value. If relative, it combines with the to make an absolute URI.
0