IndentChars Property

XmlWriterSettings.IndentChars Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the character string to use when indenting. This setting is used when the Indent property is set to true.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

'Declaration
Public Property IndentChars As String

Property Value

Type: System.String
The character string to use when indenting. This can be set to any string value. However, to ensure valid XML, you should specify only valid white space characters, such as space characters, tabs, carriage returns, or line feeds. The default is two spaces.

ExceptionCondition
ArgumentNullException

The value assigned to the IndentChars is Nothing.

This property only applies to XmlWriter instances that output text content; otherwise, this setting is ignored. The XmlWriter throws an exception if the indent characters would result in invalid XML.


Dim output As New StringBuilder()

' Create an XmlWriterSettings object with the correct options. 
Dim settings As New XmlWriterSettings()
settings.Indent = True
settings.IndentChars = vbTab
settings.OmitXmlDeclaration = True

' Create the XmlWriter object and write some content.
Using writer As XmlWriter = XmlWriter.Create(output, settings)
    writer.WriteStartElement("book")
    writer.WriteElementString("item", "tesing")
    writer.WriteEndElement()

    writer.Flush()
End Using
OutputTextBlock.Text = output.ToString()


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft