Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.Xml
- Module Module1
- Sub Main()
- Dim settings As New XmlWriterSettings()
- settings.Indent = True
- ' Initialize the XmlWriter.
- Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Users\james\Desktop\MyName.xml", settings)
- With XmlWrt
- ' Write the Xml declaration.
- .WriteStartDocument()
- ' Write a comment.
- .WriteComment("XML Database.")
- ' Write the root element.
- .WriteStartElement("Data")
- ' Start our first person.
- .WriteStartElement("Person")
- ' The person nodes.
- .WriteStartElement("Name")
- .WriteString("James")
- .WriteEndElement()
- .WriteStartElement("Email")
- .WriteEndElement()
- .WriteStartElement("Tel")
- .WriteString("111")
- .WriteEndElement()
- .WriteStartElement("Notes")
- .WriteString("bo")
- .WriteEndElement()
- ' The end of this person.
- .WriteEndElement()
- ' Close the XmlTextWriter.
- .WriteEndDocument()
- .Close()
- End With
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment