XML Formatting Preferences
To configure the XML Formatting options, open the Preferences dialog box and go to .
The following options are available:
- Format Section
- This section includes the following drop-down boxes:
- Preserve empty lines
- The Format and Indent operation preserves all empty lines found in the document.
- Preserve text as it is
- The Format and Indent operation preserves text content as it is, without removing or adding any white space.
- Preserve line breaks in attributes
- Line breaks found in attribute values are preserved.Note: When this option is enabled, the Break long attributes 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 white spaces and they follow another
element start or end tag. For 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 (for example,
<a atr1="v1"></a>). When not enabled, the same operation represents an empty element in a more compact form (<a atr1="v1"/>). - Sort attributes
- The Format and Indent operation sorts the attributes of an element lexicographically.
- Add space before slash in empty elements
- Inserts a space character before the trailing / and > of empty elements.
- Break line before an attribute name
- The Format and Indent operation breaks the line before the attribute name.
- Element Spacing Section
- This section controls how the application handles whitespaces found in XML content.
You can Add or Remove element names or
simplified XPath expressions in the various tabs.Note: The XPath expressions can accept one of the following attribute conditions (default attribute values are not taken into account):
- element[@attr] - Matches all instances of the specified element that include the specified attribute.
- element[not(@attr)] - Matches all instances of the specified element that do not include the specified attribute.
- element[@attr = "value"] - Matches all instances of the specified element that include the specified attribute with the given value.
- element[@attr != "value"] - Matches all instances of the specified element that include the specified attribute and its value is different than the one given.
The following are just examples of how simplified XPath expressions might look like:elementName//elementName/elementName1/elementName2/elementName3//xs:localNameNote: The namespace prefixes (such asxs) are treated as part of the element name without taking its binding to a namespace into account.//xs:documentation[@lang="en"]
- Schema aware format and indent
- The Format and Indent operation takes the schema information into account with regards to the space preserve, mixed, or element only properties of an element.
- Indent Section
- Includes the following options:
- Indent (when typing) in preserve space elements
- Normally, the Preserve space elements (identified by the
xml:spaceattribute set topreserveor by their presence in the Preserve space tab of the Element Spacing list) are ignored by the Format and Indent operation. When this option is enabled and you edit 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 fewer than 300 lines, the inserted content is indented. To keep the original indent style of the document you copy content from, disable this option.