Imports System.Xml
Public Class Example4
Shared Sub Main
Dim reader As XmlReader
Dim totalPrice As Double = 0
reader = XmlReader.Create("pubs.xml")
While reader.Read()
If reader.IsStartElement() = True And reader.Name = "titles" Then
reader.MoveToAttribute("price")
totalPrice += reader.ReadContentAsDouble()
End If
End While
End Sub
End Class
|