XDocument.Save serialize this XDocument to a file, optionally disabling formatting.
Imports System
Imports System.IO
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"?>
<Root><Child>content</Child></Root>
doc.Save("Root1.xml", SaveOptions.DisableFormatting)
Console.WriteLine(File.ReadAllText("Root1.xml"))
End Sub
End Class