System.Xml.XmlTextReader.XmlResolver Property

Sets the System.Xml.XmlResolver used for resolving DTD references.

Syntax

public XmlResolver XmlResolver { set; }

Value

The System.Xml.XmlResolver to use for resolving DTD references.

If this property is not set, the current instance uses a new instance of the System.Xml.XmlUrlResolver class with default credentials. If this property is set to null, any external DTD or entities encountered by the reader are not resolved.

Remarks

Note:

In the dnprdnext release, the recommended practice is to create System.Xml.XmlReader instances using the erload:System.Xml.XmlReader.Create method. This allows you to take full advantage of the new features introduced in this release. For more information, see Creating XML Readers.

The reader uses XmlResolver to resolve the location of the file loaded into the reader and also to resolve DTD references. For example, if your XML included the DOCTYPE declaration, <!DOCTYPE book SYSTEM book.dtd> the reader resolves this external file and ensures that the DTD is well-formed. The reader does not use the DTD for validation.

This property can be changed at any time and takes effect on the next read operation. If this property is set to null, any external DTD references encountered by the reader are not resolved.

In version 1.1 of the dnprdnshort, if this property is not set, the trust level of the application determines the default behavior.

Fully trusted code: The reader uses a default System.Xml.XmlUrlResolver with no user credentials. If authentication is required to access a network resource, use the XmlResolver property to specify an XmlResolver with the necessary credentials.

Semi-trusted code: The XmlResolver property is set to null. External resources are not resolved.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0