Saves the XML document to the specified file. : XML Serialize « XML « VB.Net






Saves the XML document to the specified file.

 


Imports System
Imports System.Xml

public class Sample 

  public shared sub Main() 
    Dim doc as XmlDocument = new XmlDocument()
    doc.LoadXml("<item><name>wrench</name></item>")

    Dim newElem as XmlElement = doc.CreateElement("price")
    newElem.InnerText = "10.95"
    doc.DocumentElement.AppendChild(newElem)

    doc.PreserveWhitespace = true
    doc.Save("data.xml")

  end sub
end class

   
  








Related examples in the same category

1.XmlSerializer DemoXmlSerializer Demo
2.Serialize Class to XML Document
3.Serializes an object using an XmlWriter.
4.SaveOptions.None