Altova XMLSpy 2025 Enterprise Edition

The Pretty Printing section (see screenshots below) enables you to specify how text is displayed in Text View. The definitions in this section are grouped into the following categories:

 

XML settings (select the XML tab)

JSON settings (select the JSON tab)

YAML settings (select the YAML tab)

Text View Settings (click the button to access the settings dialog)

 

The Use indentation check box switches pretty-printing on/off. The Automatically pretty-print in Text View check box can be selected to automatically apply pretty-printing when a document is loaded.

 

XML settings

The XML settings are in the XML tab and are described below the screenshot.

Click to expand/collapse

When you select an option, its effect is displayed in the preview pane at the bottom of the dialog, which allows you to see the effect before you confirm with OK. You can specify via the check box above the XML tab whether to use the indentation specified in the Text View Settings dialog or whether to use no indentation at all.

 

How empty elements are written and displayed in the document: with one tag (Self-closing) or two tags (End tag).

Whether attributes are displayed inline (on the same line as its parent element) or not. Attributes are displayed inline if Always is selected, or if Up to X attributes is selected and the number of attributes does not exceed X. Attributes are shown on new lines if Never is selected or if Up to X attributes is selected and the number of attributes does not exceeds X.

How attribute values are written: (i) with spaces on either side of the equals sign or not; (ii) whether values are enclosed in single quotes or double quotes; (iii) whether quotes in the source text are preserved as entered by you, or whether they are overridden by other options (such as Single-quotes Preferred); note that, if selected, Keep quotes is applied only as far as it is possible to do so without invalidating the document.

Whether to preserve or collapse whitespace. Whitespace characters are: space, tab, carriage return, and line feed. See the section Whitespace for details.

If elements in a document contain the xml:space="preseve" attribute-value pair, then you can specify, with the Allow use of xml:space setting, how this attribute-value pair should be treated when pretty-printing. The Always option specifies that the attribute's intention is to be followed during pretty-printng of any document: whitespace in the respective elements will be preserved and these elements will not be pretty-printed. The Never option causes the xml:space attribute to be ignored and the respective elements to be pretty-printed. The Ask option causes XMLSpy to ask what should be done every time a document containing xml:space="preseve" is pretty-printed.

Set which elements will preserve whitespace.

Whether the indentation specified in the Text View Settings dialog is used or whether no indentation is used (specified via the check box above the pane).

 

JSON settings

The JSON settings are in the JSON tab and are described below the screenshot.

Click to expand/collapse

For every option you select, the effect is shown immediately in the preview pane at the bottom of the dialog. You can specify via the check box above the JSON tab whether to use the indentation specified in the Text View Settings dialog or whether to use no indentation at all.

 

Inline Array: Displays the items of an array in a single line (or inline). You can choose to (i) never apply inline formatting, (ii) apply inline formatting to empty arrays only, (iii) apply inline formatting to arrays up to a specific size. If the size of an array is greater than the size you select, then the items are each displayed on a separate line.

Inline Object: Displays the properties of an object in a single line (or inline). You can choose to (i) never apply inline formatting, (ii) to apply inline formatting to empty objects, or (iii) apply inline formatting to objects that have up to a specified number of properties. If the size of an object is greater than the size you select, then the properties of the object  are each displayed on a separate line.

Inline Padding: If selected, adds space between the elements of non-empty inline arrays and non-empty inline objects. The option is enabled only if either the non-empty Inline Array or non-empty Inline Object option has been selected.

Inline Padding Empty: If selected, adds space inside the delimiters of empty inline arrays and empty inline objects. The option is enabled only if either an array or object is set to be inline (empty or non-empty).

Single Quoted Strings (JSON5): If selected, converts all quotes in JSON5 documents to single quotes.

Unquoted Strings (JSON5): If selected, removes, in JSON5 documents, quotes from around all keys (of key:value pairs).

 

YAML settings

The YAML settings are in the YAML tab and are described below the screenshot.

Click to expand/collapse

For every option you select, the effect is shown immediately in the preview pane at the bottom of the dialog. You can specify via the check box above the YAML tab whether to use the indentation specified in the Text View Settings dialog or whether to use no indentation at all.

 

Inline Sequence: Displays the items of a sequence in a single line (or inline) if the sequence either (i) is empty or (ii) has up to the number of items you specify. Sequences with more items than the number corresponding to the option you select will have each item on a separate line.

Inline Mappings: Displays the mappings of an object in a single line (or inline) if the object either (i) is empty or (ii) has up to the number of items you specify. Objects with more mappings than the number corresponding to the option you select will have each mapping on a separate line.

Inline Padding: If selected, adds space between the items of non-empty inline sequences and non-empty inline mappings. The option is enabled only if either the non-empty Inline Sequence or non-empty Inline Mapping option has been selected.

Inline Padding Empty: If selected, adds space inside the delimiters of empty inline sequences and empty inline mappings.

Quoted Strings: If selected, adds quotes around all strings.

Use Single Quotes: If selected, converts all quotes to single quotes.

 

Text View settings

Click Text View Settings to open the Text View Settings dialog, where you can enable properties of Text View such as indentation, bookmark margins, and auto-highlighting. The Text View Settings dialog can also be accessed via the menu command View | Text View Settings. The dialog is described there.

 

Save and exit

After making the settings, click OK to finish.

 

© 2018-2024 Altova GmbH