The XML Format preferences panel is opened from menu Options > Preferences > Editor > Format > XML.
The following options are available:
Preserve empty lines - The Format and Indent
operation preserves all empty lines found in the document. Enabled by default.
Preserve text as it is - The Format and
Indent operation preserves text content as it is, without removing or adding
any whitespace.
Preserve line breaks in attributes - Line breaks found in attribute
values are preserved. Enabled by default.
Note: When this option is enabled, Break
long lines option is automatically disabled.
Break long attributes - The Format and
Indent operation breaks long attribute values.
Indent inline elements - The inline
elements are indented on separate lines if they are preceded by whitespaces and
they follow another element start or end tag. Enabled by default. Example:
Original XML:
<root>
text <parent> <child></child> </parent>
</root>
Indent
inline elements
enabled:
<root> text <parent>
<child/>
</parent>
</root>
Indent
inline elements
disabled:
<root> text <parent> <child/> </parent> </root>
Expand empty elements - The Format and
Indent operation outputs empty elements with a separate closing tag, ex.
<a atr1="v1"></a>. When not checked, the same operation
represents an empty element in a more compact form: <a
atr1="v1"/>.
Sort attributes - The Format and Indent
operation alphabetically sorts the attributes of an element.
Add space before slash in empty elements - Inserts a space
character before the trailing / and > of empty elements.
Break line before attribute's name - Format and
Indent operation breaks the line before the attribute name.
Element spacing Here you can control how the application handles
whitespaces found in XML content.
Preserve space - List of elements for which the
Format and Indent operation preserves the whitespaces (like
blanks, tabs, and newlines). The elements can be specified by name or by XPath expressions:
elementName
//elementName
/elementName1/elementName2/elementName3
//xs:localName
The namespace prefixes like xs are treated as part of the element
name without taking into account its binding to a namespace.
Default space - This list contains the names of the elements
for which contiguous whitespaces are merged by the Format and
Indent operation into one blank character.
Mixed content - The elements from this list are treated as
mixed when applying the Format and Indent operation. The lines
are split only when whitespaces are encountered.
Schema aware format and indent - The
Format and Indent operation takes into account the schema
information regarding the space preserve, mixed, or element only
properties of an element. Enabled by default.
Indent (when typing) in preserve space elements - Preserve
space elements (identified by the xml:space attribute set to
preserve or by their presence in the Preserve
space elements list) are normally ignored by the Format and
Indent operation. When this option is enabled and you are editing one of these
elements, its content is formatted.
Indent on paste - sections with number of lines less than 300 -
When you paste a chunk of text that has less than 300 lines, the inserted content is
indented. If you want to keep the indent style of the document you are copying content from,
disable this option.