XmlReader.Create Method (XmlReader, XmlReaderSettings)

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

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

Syntax

'Declaration
Public Shared Function Create ( _
    reader As XmlReader, _
    settings As XmlReaderSettings _
) As XmlReader
public static XmlReader Create(
    XmlReader reader,
    XmlReaderSettings settings
)

Parameters

Return Value

Type: System.Xml.XmlReader
An XmlReader object that is wrapped around the specified XmlReader object.

Exceptions

Exception Condition
NullReferenceException

The reader value is nulla null reference (Nothing in Visual Basic).

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.

Remarks

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.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 Wrapping a custom reader is allowed in Silverlight for 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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.