XDocument.Load (XmlReader) creates a new XDocument from an XmlReader.
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim doc As XmlDocument = New XmlDocument()
Dim child As XmlElement = doc.CreateElement("Child")
child.InnerText = "child contents"
Dim root As XmlElement = doc.CreateElement("Root")
root.AppendChild(child)
doc.AppendChild(root)
Using nodeReader = New XmlNodeReader(doc)
nodeReader.MoveToContent()
Dim xRoot As XDocument = XDocument.Load(nodeReader)
Console.WriteLine(xRoot)
End Using
End Sub
End Class