XmlWriterSettings.NewLineOnAttributes Property

Gets or sets a value indicating whether to write attributes on a new line.

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

Public Property NewLineOnAttributes As Boolean

Property Value

Type: System.Boolean
true to write attributes on individual lines; otherwise false. The default is false.

This setting has no effect when the Indent property value is false.

When NewLineOnAttributes is set to true, each attribute is pre-pended with a new line and one extra level of indentation.

This property only applies to XmlWriter instances that output text content; otherwise, this setting is ignored.

For more information and code examples, see XML Data.

Dim output As New StringBuilder()

Dim settings As New XmlWriterSettings()
settings.Indent = True
settings.OmitXmlDeclaration = True
settings.NewLineOnAttributes = True

Using writer As XmlWriter = XmlWriter.Create(output, settings)

    writer.WriteAttributeString("orderID", "367A54")
    writer.WriteAttributeString("date", "2001-05-03")
    writer.WriteElementString("price", "19.95")

End Using
OutputTextBlock.Text = output.ToString()


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions