Read xml document by using the XmlTextReader : XmlTextReader « XML « VB.Net Tutorial






Imports System.Xml.Serialization, System.IO
Imports System.Xml
Public Class Tester
    Public Shared Sub Main
    
      Dim myXMLTextReader As New XmlTextReader("doc.xml")
      myXMLTextReader.ReadStartElement("UserChoice")
      Do While myXMLTextReader.Read()
         If myXMLTextReader.Name = "UserChoice" Then Exit Do

         Console.WriteLine(myXMLTextReader.ReadOuterXml)

      Loop
      myXMLTextReader.Close()

    End Sub

End Class
value








25.2.XmlTextReader
25.2.1.Read xml document by using the XmlTextReader
25.2.2.Loads an XML string into the XmlTextReader object using the StringReader class.