Imports System.IO
Imports System.Xml
Public Class Form1
Public Shared Sub Main()
Dim doc As New XmlDocument()
doc.Load("c:\test.xml")
Dim r As XmlNodeReader = New XmlNodeReader(doc)
Dim ElementNumber As Integer
Do
ElementNumber += 1
System.Console.WriteLine(ElementNumber.ToString & ". " & r.NodeType.ToString)
If Not r.Name = "" Then System.Console.WriteLine(" Name: " & r.Name)
If Not r.Value = "" Then System.Console.WriteLine(" Value: " & r.Value)
If r.HasAttributes Then
Dim i As Integer
For i = 0 To r.AttributeCount - 1
r.MoveToAttribute(i)
System.Console.WriteLine("Attribute #" & (i + 1).ToString)
System.Console.WriteLine("Name: " & r.Name)
System.Console.WriteLine("Value: " & r.Value)
Next i
r.MoveToElement()
End If
Loop While r.Read() = True
End Sub
End Class
|