Mega Code Archive

 
Categories / VB.Net / XML
 

XmlReader ReadElementString reads a text-only element

Imports System Imports System.Xml public class Sample   private const filename as string = "book.xml"   public shared Sub Main()     Dim reader as XmlTextReader = Nothing     try       reader = new XmlTextReader(filename)       reader.WhitespaceHandling = WhitespaceHandling.None       reader.MoveToContent()       Console.WriteLine("Content of the price element: {0}", reader.ReadElementString())     finally       if Not reader Is Nothing         reader.Close()       End if     End try   End Sub End class