Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

279 lines
18 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Type Name="XmlResolver" FullName="System.Xml.XmlResolver" FullNameSP="System_Xml_XmlResolver" Maintainer="ecma">
<TypeSignature Language="ILASM" Value=".class public abstract XmlResolver extends System.Object" />
<TypeSignature Language="C#" Value="public abstract class XmlResolver" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit XmlResolver extends System.Object" />
<MemberOfLibrary>XML</MemberOfLibrary>
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XmlResolver 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.</para>
<para>
<see cref="T:System.Xml.XmlUrlResolver" /> is a concrete implementation of XmlResolver and is the default resolver for all classes in the System.Xml namespace. You can also create your own resolver.</para>
<format type="text/html">
<h2>Security Considerations</h2>
</format>
<para>Consider the following items when working with the <see cref="T:System.Xml.XmlResolver" /> class.</para>
<list type="bullet">
<item>
<para>
<see cref="T:System.Xml.XmlResolver" /> objects can contain sensitive information such as user credentials. You should be careful when caching <see cref="T:System.Xml.XmlResolver" /> objects and should not pass the <see cref="T:System.Xml.XmlResolver" /> object to an untrusted component.</para>
</item>
<item>
<para>If you are designing a class property that uses the <see cref="T:System.Xml.XmlResolver" /> class, the property should be defined as a write-only property. The property can be used to specify the <see cref="T:System.Xml.XmlResolver" /> to use, but it cannot be used to return an <see cref="T:System.Xml.XmlResolver" /> object.</para>
</item>
<item>
<para>If your application accepts <see cref="T:System.Xml.XmlResolver" /> objects from untrusted code, you cannot assume that the URI passed into the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method will be the same as that returned by the <see cref="M:System.Xml.XmlResolver.ResolveUri(System.Uri,System.String)" /> method. Classes derived from the <see cref="T:System.Xml.XmlResolver" /> class can override the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method and return data that is different than what was contained in the original URI.</para>
</item>
<item>
<para>Your application can mitigate memory Denial of Service threats to the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method by implementing a wrapping implemented IStream that limits the number of bytes read. This helps to guard against situations where malicious code attempts to pass an infinite stream of bytes to the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method.</para>
</item>
</list>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Resolves external XML resources named by a Uniform Resource Identifier (URI).</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="ILASM" Value="family specialname instance void .ctor()" />
<MemberSignature Language="C#" Value="protected XmlResolver ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue />
<Parameters />
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This constructor is called by derived class constructors to initialize state in this type.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Xml.XmlResolver" /> class.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="Credentials">
<MemberSignature Language="ILASM" Value=".property class System.Net.ICredentials Credentials { public hidebysig virtual abstract specialname void set_Credentials(class System.Net.ICredentials value) }" />
<MemberSignature Language="C#" Value="public virtual System.Net.ICredentials Credentials { set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Net.ICredentials Credentials" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Net.ICredentials</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<value>
<para>A <see cref="T:System.Net.ICredentials" /> instance
containing the
credentials.</para>
</value>
<example>
<para>See <see cref="P:System.Xml.XmlUrlResolver.Credentials" /> for an example using this property.</para>
</example>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>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.</para>
<para>The following C# code sets credentials on the <see cref="T:System.Xml.XmlResolver" /> object.</para>
<code>NetworkCredential nc = new NetWorkCredential(UserName,SecurelyStoredPassword,Domain);
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = nc;</code>
<para>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.</para>
<code>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;</code>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>When overridden in a derived class, sets the credentials used to authenticate Web requests.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="GetEntity">
<MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract object GetEntity(class System.Uri absoluteUri, string role, class System.Type ofObjectToReturn)" />
<MemberSignature Language="C#" Value="public abstract object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance object GetEntity(class System.Uri absoluteUri, string role, class System.Type ofObjectToReturn) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="absoluteUri" Type="System.Uri" />
<Parameter Name="role" Type="System.String" />
<Parameter Name="ofObjectToReturn" Type="System.Type" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentNullException">
<paramref name="absoluteUri" /> is <see langword="null" />.</exception>
<exception cref="T:System.Xml.XmlException">
<paramref name="ofObjectToReturn" /> is not a supported type.</exception>
<exception cref="T:System.NullReferenceException">
<paramref name="absoluteUri" /> is <see langword="null" />.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>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.</para>
<para>For the asynchronous version of this method, see <see cref="M:System.Xml.XmlResolver.GetEntityAsync(System.Uri,System.String,System.Type)" />.</para>
<block subset="none" type="note">
<para>Your application can mitigate memory Denial of Service threats to the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method by implementing a wrapping implemented IStream that limits the number of bytes read. This helps to guard against situations where malicious code attempts to pass an infinite stream of bytes to the <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" /> method.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>When overridden in a derived class, maps a URI to an object containing the actual resource.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A <see cref="T:System.IO.Stream" /> object or null if a type other than stream is specified.</para>
</returns>
<param name="absoluteUri">
<attribution license="cc4" from="Microsoft" modified="false" />The URI returned from <see cref="M:System.Xml.XmlResolver.ResolveUri(System.Uri,System.String)" />.</param>
<param name="role">
<attribution license="cc4" from="Microsoft" modified="false" />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.</param>
<param name="ofObjectToReturn">
<attribution license="cc4" from="Microsoft" modified="false" />The type of object to return. The current version only returns System.IO.Stream objects.</param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="GetEntityAsync">
<MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task&lt;object&gt; GetEntityAsync (Uri absoluteUri, string role, Type ofObjectToReturn);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1&lt;object&gt; GetEntityAsync(class System.Uri absoluteUri, string role, class System.Type ofObjectToReturn) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task&lt;System.Object&gt;</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="absoluteUri" Type="System.Uri" />
<Parameter Name="role" Type="System.String" />
<Parameter Name="ofObjectToReturn" Type="System.Type" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This is the asynchronous version of <see cref="M:System.Xml.XmlResolver.GetEntity(System.Uri,System.String,System.Type)" />, with the same functionality. To use this method, you must set the <see cref="P:System.Xml.XmlReaderSettings.Async" /> flag to true.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Asynchronously maps a URI to an object containing the actual resource.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A <see cref="T:System.IO.Stream" /> object or null if a type other than stream is specified.</para>
</returns>
<param name="absoluteUri">
<attribution license="cc4" from="Microsoft" modified="false" />The URI returned from <see cref="M:System.Xml.XmlResolver.ResolveUri(System.Uri,System.String)" />.</param>
<param name="role">
<attribution license="cc4" from="Microsoft" modified="false" />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.</param>
<param name="ofObjectToReturn">
<attribution license="cc4" from="Microsoft" modified="false" />The type of object to return. The current version only returns <see cref="T:System.IO.Stream" /> objects.</param>
</Docs>
</Member>
<Member MemberName="ResolveUri">
<MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract class System.Uri ResolveUri(class System.Uri baseUri, string relativeUri)" />
<MemberSignature Language="C#" Value="public virtual Uri ResolveUri (Uri baseUri, string relativeUri);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Uri ResolveUri(class System.Uri baseUri, string relativeUri) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Uri</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="baseUri" Type="System.Uri" />
<Parameter Name="relativeUri" Type="System.String" />
</Parameters>
<Docs>
<exception cref="T:System.Xml.XmlException">
<paramref name="baseUri" /> and <paramref name="relativeUri" /> are <see langword="null" />.</exception>
<exception cref="T:System.Xml.ArgumentException">
<paramref name="baseUri" /> and <paramref name="relativeUri" /> are <see langword="null" />.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The absolute URI may be used as the base URI for any subsequent requests for entities that are relative to this URI.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>When overridden in a derived class, resolves the absolute URI from the base and relative URIs.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A <see cref="T:System.Uri" /> representing the absolute URI or null if the relative URI cannot be resolved.</para>
</returns>
<param name="baseUri">
<attribution license="cc4" from="Microsoft" modified="false" />The base URI used to resolve the relative URI.</param>
<param name="relativeUri">
<attribution license="cc4" from="Microsoft" modified="false" />The URI to resolve. The URI can be absolute or relative. If absolute, this value effectively replaces the <paramref name="baseUri" /> value. If relative, it combines with the <paramref name="baseUri" /> to make an absolute URI.</param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="SupportsType">
<MemberSignature Language="C#" Value="public virtual bool SupportsType (Uri absoluteUri, Type type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool SupportsType(class System.Uri absoluteUri, class System.Type type) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="absoluteUri" Type="System.Uri" />
<Parameter Name="type" Type="System.Type" />
</Parameters>
<Docs>
<remarks>To be added.</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Adds the ability for the resolver to return other types than just <see cref="T:System.IO.Stream" />.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the <paramref name="type" /> is supported; otherwise, false.</para>
</returns>
<param name="absoluteUri">
<attribution license="cc4" from="Microsoft" modified="false" />The URI.</param>
<param name="type">
<attribution license="cc4" from="Microsoft" modified="false" />The type to return.</param>
</Docs>
</Member>
</Members>
<TypeExcluded>0</TypeExcluded>
</Type>