Create Method (XmlReader, XmlReaderSettings)

XmlReader.Create Method (XmlReader, XmlReaderSettings)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Creates a new XmlReader instance with the specified XmlReader and XmlReaderSettings objects.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public static XmlReader Create(
	XmlReader reader,
	XmlReaderSettings settings
)

Parameters

reader
Type: System.Xml.XmlReader
The XmlReader object that you wish to use as the underlying reader.
settings
Type: System.Xml.XmlReaderSettings
The XmlReaderSettings object used to configure 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 XmlReader object that is wrapped around the specified XmlReader object.

ExceptionCondition
NullReferenceException

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-

The underlying XmlReader is in an Error or Closed state.

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.

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

Version Notes

Windows Phone

 Wrapping a custom reader is allowed in Windows Phone. That is, you can create a custom reader with your own implementations of the required functions, and then pass the custom reader as input to Create. You must set the ConformanceLevel in XmlReaderSettings to Auto when wrapping a custom reader.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft