Imports System
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim sr As TextReader = New StringReader( _
"" & Environment.NewLine & _
" " & Environment.NewLine & _
" " & Environment.NewLine & _
" " & Environment.NewLine & _
" " & Environment.NewLine & _
"")
Dim po As XElement = XElement.Load(sr, LoadOptions.SetLineInfo)
For Each e As XElement In po.DescendantsAndSelf()
Console.WriteLine("{0}{1}{2}", _
("".PadRight(e.Ancestors().Count() * 2) & e.Name.ToString).PadRight(20), _
(DirectCast(e, IXmlLineInfo)).LineNumber.ToString().PadRight(5), _
(DirectCast(e, IXmlLineInfo)).LinePosition)
Next
End Sub
End Class