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.
Assembly: System.Xml (in System.Xml.dll)
Property Value
Type: System.StringThe 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.
| Exception | Condition |
|---|---|
| ArgumentNullException | The value assigned to the IndentChars is Nothing. |
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()
Show: