System.Xml.XmlReader.Create Method

Creates a new System.Xml.XmlReader instance using the specified System.IO.TextReader, System.Xml.XmlReaderSettings, and base URI.

Syntax

public static XmlReader Create (System.IO.TextReader input, XmlReaderSettings settings, string baseUri)

Parameters

input
The System.IO.TextReader from which to read the XML data. Because a System.IO.TextReader returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the System.Xml.XmlReader to decode the data stream.
settings
The System.Xml.XmlReaderSettings object used to configure the new System.Xml.XmlReader instance. This value can be null.
baseUri
The base URI for the entity or document being read. This value can be null.

Returns

An System.Xml.XmlReader object to read XML data.

Remarks

By default an System.Xml.XmlUrlResolver with no credentials is used to access any external resources such as a document type definition (DTD), entities, schemas, and so on. If the external resource is located on a network resource that requires authentication, use the XmlReaderSettings.XmlResolver property to specify an System.Xml.XmlResolver with the necessary credentials.

Note:

You can use one of the following methods to control which resources the System.Xml.XmlReader can access:

Restrict the resources that the System.Xml.XmlReader can access by setting the XmlReaderSettings.XmlResolver property to an System.Xml.XmlSecureResolver object.

-or-

Do not allow the System.Xml.XmlReader to open any external resources by setting the XmlReaderSettings.XmlResolver property to null.

The created System.Xml.XmlReader object expands entity references and performs XML normalization of new line characters.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0