Mega Code Archive

 
Categories / VB.Net / XML
 

XmlReader ReadContentAsBoolean reads the text content at the current position as a Boolean

Imports System Imports System.IO Imports System.Xml Public Class Sample   Public Shared Sub Main()           Using reader As XmlReader = XmlReader.Create("data.xml")           reader.ReadToDescendant("item")           Do             reader.MoveToAttribute("sale-item")             Dim onSale As [Boolean] = reader.ReadContentAsBoolean()             If onSale Then               Console.WriteLine(reader("productID"))             End If           Loop While reader.ReadToNextSibling("item")                  End Using     End Sub End Class