다음을 통해 공유


Options, Text Editor, XML, Formatting

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Use the Formatting options page to specify how elements and attributes are formatted in your XML documents. To access XML formatting options, choose Tools > Options > Text Editor > XML, and then choose Formatting.

Attributes

Preserve manual attribute formatting

Do not reformat attributes. This setting is the default.

Note

If the attributes are on multiple lines, the editor indents each line of attributes to match the indentation of the parent element.

Align attributes each on a separate line

Align the second and subsequent attributes vertically to match the indentation of the first attribute. The following XML text is an example of how the attributes would be aligned:

<item id = "123-A"
      name = "hammer"
      price = "9.95">
</item>

Auto Reformat

On paste from clipboard

Reformat XML text pasted from the clipboard.

On completion of end tag

Reformat the element when the end tag is completed.

Mixed Content

Format mixed content by default.

Attempt to reformat mixed content, except when the content is found in an xml:space="preserve" scope. This setting is the default.

If an element contains a mix of text and markup, the contents are considered to be mixed content. Following is an example of an element with mixed content.

<dir>c:\data\AlphaProject\
  <file readOnly="false">test1.txt</file>
  <file readOnly="false">test2.txt</file>
</dir>

See also