XDocument.Root Property gets the root element of the XML Tree for this document.
Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass Public Shared Sub Main() Dim doc As XDocument = _ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!--This is a comment.--> <Pubs> <Book> <Title>C#</Title> <Author>MJordao</Author> </Book> <Book> <Title>XML</Title> <Author>G</Author> </Book> <!--This is another comment.--> </Pubs> Console.WriteLine(doc.Root.Name.ToString()) End Sub End Class