XmlReader.Create Method (TextReader)

Creates a new XmlReader instance with the specified TextReader.

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

Public Shared Function Create ( _
	input As TextReader _
) As XmlReader


Type: System.IO.TextReader
The TextReader from which to read the XML data. Because a TextReader returns a stream of Unicode characters, the encoding specified in the XML declaration is not used by the XmlReader to decode the data stream.

Return Value

Type: System.Xml.XmlReader
An XmlReader object to read the XML data.


The input value is Nothing.

An XmlReaderSettings object with default settings is used to create the reader. If you wish to specify the features to support on the created reader, use the overload that takes an XmlReaderSettings object as one of its arguments, and pass in an XmlReaderSettings object with the correct settings.

Dim output As New StringBuilder()

Dim xmlString As String = _
            "<root>" & _
            "<stringValue><!--comment-->" & _
            "<?some pi?>text value of the element." & _
            "</stringValue>" & _
            "<longValue>270000000000001</longValue><number>0</number>" & _
            "<double>2E10</double><date>2003-01-08T15:00:00-00:00</date>" & _

Using reader As XmlReader = XmlReader.Create(New StringReader(xmlString))
    Dim number As Long = reader.ReadElementContentAsLong()
End Using

OutputTextBlock.Text = output.ToString()


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

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

Community Additions