XElement.Save (String, SaveOptions) serialize element to a file, optionally disabling formatting. : XML Save « XML LINQ « VB.Net






XElement.Save (String, SaveOptions) serialize element 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 str As String
        Dim root As XElement = <Root><Child> Text </Child></Root>
        
        root.Save("Root.xml", SaveOptions.DisableFormatting)
        str = File.ReadAllText("Root.xml")
        Console.WriteLine(str)
        
        root.Save("Root.xml", SaveOptions.None)
        str = File.ReadAllText("Root.xml")
        Console.WriteLine(str)

    End Sub
End Class

   
    
  








Related examples in the same category

1.XElement.Save (String) serialize this element to a file.
2.XElement.Save (TextWriter) serializes this element to a TextWriter.
3.XElement.Save (TextWriter, SaveOptions) serializes this element to a TextWriter