XmlReader::Create Method (XmlReader^, XmlReaderSettings^)
Creates a new XmlReader instance by using the specified XML reader and settings.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- reader
-
Type:
System.Xml::XmlReader^
The object that you want to use as the underlying XML reader.
- settings
-
Type:
System.Xml::XmlReaderSettings^
The settings for the new XmlReader instance.
The conformance level of the XmlReaderSettings object must either match the conformance level of the underlying reader, or it must be set to Auto.
Return Value
Type: System.Xml::XmlReader^An object that is wrapped around the specified XmlReader object.
| Exception | Condition |
|---|---|
| ArgumentNullException | The reader value is null. |
| InvalidOperationException | If the XmlReaderSettings object specifies a conformance level that is not consistent with conformance level of the underlying reader. -or- |
This method allows you add additional features to an underlying XmlReader object. The underlying XmlReader object can be another XmlReader object created by the Create method, or an XmlReader object created using one of the concrete XmlReader implementations.
A default XmlUrlResolver with no credentials is used to access any external resources such as a schema.
Important |
|---|
Starting with the .NET Framework 4.5.2, no default XmlUrlResolver is provided. If your solution targets the .NET Framework 4.5.2 or later versions, specify an XmlResolver using the XmlReaderSettings::XmlResolver property. |
If the external resource is located on a network resource that requires authentication, specify an XmlResolver with the necessary credentials using the XmlReaderSettings::XmlResolver property.
Security Note
|
|---|
You can use one of the following methods to control which resources the XmlReader can access:
-or-
|
The created XmlReader object expands entity references and performs XML normalization of new line characters.
The following example creates a validating XmlReader object that is wrapped around an XmlNodeReader object.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1

