XML - Formatting Style
- Tabs and indents
- Line wrapping
- Processing Instructions
- Inside of tag header
- Tag content
- Keep existing line breaks
- Line breaks after start-tag and before end-tag in multiline elements
- Line breaks after start-tag and before end-tag in elements that contain other elements and no text
- Line breaks after start-tag and before end-tag when element is longer than
- Spaces after start-tag and before end-tag otherwise
- Wrap inside text
- Wrap before and after elements
- Indent inside element that doesn't contain text
- Indent inside element that contain text
- Around tags
- Other
Tabs and indents
Indent style
Property names:
xml_indent_style
, indent_style
Possible values:
-
space
: Spaces -
tab
: Tab
Examples:
space |
<tag1>
····<tag2>
········text
····</tag2>
</tag1> |
tab |
<tag1>
→<tag2>
→→text
→</tag2>
</tag1> |
Indent size
Property names:
xml_indent_size
, indent_size
Possible values:
an integer
Examples:
value: 0 |
<tag1>
·<tag2>
··text
·</tag2>
</tag1> |
value: 1 |
<tag1>
·<tag2>
··text
·</tag2>
</tag1> |
value: 2 |
<tag1>
··<tag2>
····text
··</tag2>
</tag1> |
Tab width
Property names:
xml_tab_width
, tab_width
Possible values:
an integer
Examples:
value: 0 |
<tag1>
→<tag2>
→→text
→</tag2>
</tag1> |
value: 1 |
<tag1>
→<tag2>
→→text
→</tag2>
</tag1> |
value: 2 |
<tag1>
→<tag2>
→→text
→</tag2>
</tag1> |
Line wrapping
Right margin (columns)
Property names:
xml_max_line_length
, max_line_length
Possible values:
an integer
Wrap tags and processing instructions
Property names:
[resharper_]xml_wrap_tags_and_pi
, [resharper_]wrap_tags_and_pi
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
<tag·attr1='1234567890'·attr2='1234567890'/> | <tag·attr1='1234567890'
·····attr2='1234567890'·/> |
Before formatting | After formatting, false |
<tag·attr1='1234567890'·attr2='1234567890'/> | <tag·attr1='1234567890'·attr2='1234567890'·/> |
Processing Instructions
Spaces around '=' in attribute
Property names:
[resharper_]xml_spaces_around_eq_in_pi_attribute
, [resharper_]spaces_around_eq_in_pi_attribute
Possible values:
true | false
Examples:
true |
<?xml·version·=·'1.0'·encoding·=·'utf-8'?> |
false |
<?xml·version='1.0'·encoding='utf-8'?> |
Space after last attribute
Property names:
[resharper_]xml_space_after_last_pi_attribute
, [resharper_]space_after_last_pi_attribute
Possible values:
true | false
Examples:
true |
<?xml·version='1.0'·encoding='utf-8'·?> |
false |
<?xml·version='1.0'·encoding='utf-8'?> |
Attributes format
Property names:
[resharper_]xml_pi_attribute_style
, [resharper_]pi_attribute_style
Possible values:
-
on_different_lines
: Each attribute on separate lines -
do_not_touch
: Do not touch -
on_single_line
: On single line -
first_attribute_on_single_line
: First attribute on single line
Examples:
on_different_lines |
<?xml
··version='1.0'
··encoding='utf-8'?> |
do_not_touch |
<?xml·version='1.0'·encoding='utf-8'?> |
on_single_line |
<?xml·version='1.0'·encoding='utf-8'?> |
first_attribute_on_single_line |
<?xml·version='1.0'
······encoding='utf-8'?> |
Attributes indenting
Property names:
[resharper_]xml_pi_attributes_indent
, [resharper_]pi_attributes_indent
Possible values:
-
align_by_first_attribute
: Align by first attribute -
double_indent
: Double indent -
single_indent
: Single indent
Examples:
align_by_first_attribute |
<?xml·version='1.0'
······encoding='utf-8'?> |
double_indent |
<?xml·version='1.0'
····encoding='utf-8'?> |
single_indent |
<?xml·version='1.0'
··encoding='utf-8'?> |
Blank line after processing instructions
Property names:
[resharper_]xml_blank_line_after_pi
, [resharper_]blank_line_after_pi
Possible values:
true | false
Examples:
true |
<?xml·version='1.0'·encoding='utf-8'?>
<a·/> |
false |
<?xml·version='1.0'·encoding='utf-8'?>
<a·/> |
Inside of tag header
Spaces around '=' in attribute
Property names:
[resharper_]xml_spaces_around_eq_in_attribute
, [resharper_]spaces_around_eq_in_attribute
Possible values:
true | false
Examples:
true |
<a·x·=·'1'·y·=·'2'·z·=·'3'·/> |
false |
<a·x='1'·y='2'·z='3'·/> |
Space after last attribute
Property names:
[resharper_]xml_space_after_last_attribute
, [resharper_]space_after_last_attribute
Possible values:
true | false
Examples:
true |
<a·x='1'·y='2'·z='3'·>text</a> |
false |
<a·x='1'·y='2'·z='3'>text</a> |
Space before '/>'
Property names:
[resharper_]xml_space_before_self_closing
, [resharper_]space_before_self_closing
Possible values:
true | false
Examples:
true |
<a·/> |
false |
<a/> |
Attributes format
Property names:
[resharper_]xml_attribute_style
, [resharper_]attribute_style
Possible values:
-
on_different_lines
: Each attribute on separate lines -
do_not_touch
: Do not touch -
on_single_line
: On single line -
first_attribute_on_single_line
: First attribute on single line
Examples:
on_different_lines |
<a
··x='1'
··y='2'
··z='3'·/> |
do_not_touch |
<a·x='1'·y='2'·z='3'·/> |
on_single_line |
<a·x='1'·y='2'·z='3'·/> |
first_attribute_on_single_line |
<a·x='1'
···y='2'
···z='3'·/> |
Attributes indenting
Property names:
[resharper_]xml_attribute_indent
, [resharper_]attribute_indent
Possible values:
-
align_by_first_attribute
: Align by first attribute -
double_indent
: Double indent -
single_indent
: Single indent
Examples:
align_by_first_attribute |
<a·x='1'
···y='2'
···z='3'·/> |
double_indent |
<a·x='1'
····y='2'
····z='3'·/> |
single_indent |
<a·x='1'
··y='2'
··z='3'·/> |
Tag content
Keep existing line breaks
Property names:
[resharper_]xml_keep_user_linebreaks
, [resharper_]keep_user_linebreaks
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
<summary>
text
more·text
</summary> | <summary>
··text
··more·text
</summary> |
Before formatting | After formatting, false |
<summary>
text
more·text
</summary> | <summary>text·more·text</summary> |
Line breaks after start-tag and before end-tag in multiline elements
Property names:
[resharper_]xml_linebreaks_inside_tags_for_multiline_elements
, [resharper_]linebreaks_inside_tags_for_multiline_elements
Possible values:
true | false
Examples:
true |
<tag>
··text·text·text
··Text·text·text·text·text·text·text·text·text
</tag> |
false |
<tag>text·text·text
··Text·text·text·text·text·text·text·text·text</tag> |
Line breaks after start-tag and before end-tag in elements that contain other elements and no text
Property names:
[resharper_]xml_linebreaks_inside_tags_for_elements_with_child_elements
, [resharper_]linebreaks_inside_tags_for_elements_with_child_elements
Possible values:
true | false
Examples:
true |
<tag>
··<othertag>text</othertag>
</tag> |
false |
<tag><othertag>text</othertag></tag> |
Line breaks after start-tag and before end-tag when element is longer than
Property names:
[resharper_]xml_linebreaks_inside_tags_for_elements_longer_than
, [resharper_]linebreaks_inside_tags_for_elements_longer_than
Format long tags like this:
<tag>
content
</tag>
Possible values:
an integer
Spaces after start-tag and before end-tag otherwise
Property names:
[resharper_]xml_spaces_inside_tags
, [resharper_]spaces_inside_tags
Possible values:
true | false
Examples:
true |
<tag>·Text·text·text·text·text·text·text·text·text·</tag> |
false |
<tag>Text·text·text·text·text·text·text·text·text</tag> |
Wrap inside text
Property names:
[resharper_]xml_wrap_text
, [resharper_]wrap_text
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
<tag>
··Text·text·text·text·text·text·text·text·text
</tag> | <tag>
··Text·text·text·text·text
··text·text·text·text
</tag> |
Before formatting | After formatting, false |
<tag>
··Text·text·text·text·text·text·text·text·text
</tag> | <tag>
··Text·text·text·text·text·text·text·text·text
</tag> |
Wrap before and after elements
Property names:
[resharper_]xml_wrap_around_elements
, [resharper_]wrap_around_elements
Possible values:
true | false
Examples:
Before formatting | After formatting, true |
<tag>
··Text·text·text·text·text·<tag/>·text·text·text
</tag> | <tag>
··Text·text·text·text·text
··<tag·/>·text·text·text
</tag> |
Before formatting | After formatting, false |
<tag>
··Text·text·text·text·text·<tag/>·text·text·text
</tag> | <tag>
··Text·text·text·text·text·<tag·/>·text·text·text
</tag> |
Indent inside element that doesn't contain text
Property names:
[resharper_]xml_indent_child_elements
, [resharper_]indent_child_elements
Possible values:
-
zeroindent
: No indent from parent element -
removeindent
: No indent at all -
donottouch
: Do not change indenting -
oneindent
: One indent from parent element
Examples:
zeroindent |
<toplevel>
<summary>
<tag·/>
<tag·/>
</summary>
</toplevel> |
removeindent |
<toplevel>
<summary>
<tag·/>
<tag·/>
</summary>
</toplevel> |
donottouch |
<toplevel>
<summary>
<tag·/>
······················<tag·/>
</summary>
</toplevel> |
oneindent |
<toplevel>
··<summary>
····<tag·/>
····<tag·/>
··</summary>
</toplevel> |
Indent inside element that contain text
Property names:
[resharper_]xml_indent_text
, [resharper_]indent_text
Possible values:
-
zeroindent
: No indent from parent element -
removeindent
: No indent at all -
donottouch
: Do not change indenting -
oneindent
: One indent from parent element
Examples:
zeroindent |
<toplevel>
··<summary>
··text1
··text2
··</summary>
</toplevel> |
removeindent |
<toplevel>
··<summary>
text1
text2
··</summary>
</toplevel> |
donottouch |
<toplevel>
··<summary>
text1
······················text2
··</summary>
</toplevel> |
oneindent |
<toplevel>
··<summary>
····text1
····text2
··</summary>
</toplevel> |
Around tags
Maximum blank lines between tags
Property names:
[resharper_]xml_max_blank_lines_between_tags
, [resharper_]max_blank_lines_between_tags
Maximum blank lines between tags
Possible values:
an integer
Place multiline elements on new line
Property names:
[resharper_]xml_linebreak_before_multiline_elements
, [resharper_]linebreak_before_multiline_elements
Possible values:
true | false
Examples:
true |
<exception>
··Text
··<tag>
····text
··</tag>
··text
</exception> |
false |
<exception>
··Text·<tag>
····text
··</tag>·text
</exception> |
Place singleline elements on new line
Property names:
[resharper_]xml_linebreak_before_singleline_elements
, [resharper_]linebreak_before_singleline_elements
Possible values:
true | false
Examples:
true |
<exception>
··See
··<see·cref="something"·/>
··for·more·info
</exception> |
false |
<exception>
··See·<see·cref="something"·/>·for·more·info
</exception> |
Other
Line feed at end of file
Property names:
xml_insert_final_newline
, insert_final_newline
Possible values:
true | false