VB.Net by API/System.Xml/XmlTextWriter

Материал из VB Эксперт
Перейти к: навигация, поиск

XmlTextWriter.Formatting

  
Imports System.Xml.Serialization, System.IO
Imports System.Xml
Public Class Tester
    Public Shared Sub Main
    
      Dim myXmlTextWriter As New XmlTextWriter("doc.xml", Nothing)
      With myXmlTextWriter
         .Formatting = Formatting.Indented
         .Indentation = 3
         .IndentChar = " "
         .WriteStartDocument()
         .WriteComment("This is a sample XML document generated" & _
            " using an XMLTextWriter object.")
         .WriteStartElement("UserChoice")
         .WriteElementString("element", "value")
         .WriteEndElement()
         .Close()
      End With
    End Sub
End Class


XmlTextWriter.IndentChar

  
Imports System.Xml.Serialization, System.IO
Imports System.Xml
Public Class Tester
    Public Shared Sub Main
    
      Dim myXmlTextWriter As New XmlTextWriter("doc.xml", Nothing)
      With myXmlTextWriter
         .Formatting = Formatting.Indented
         .Indentation = 3
         .IndentChar = " "
         .WriteStartDocument()
         .WriteComment("This is a sample XML document generated" & _
            " using an XMLTextWriter object.")
         .WriteStartElement("UserChoice")
         .WriteElementString("element", "value")
         .WriteEndElement()
         .Close()
      End With
    End Sub
End Class