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 to access these settings; screenshot below left)
•JSON settings (select the JSON tab to access these settings; screenshot below right)
•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.
The following settings are available:
•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)
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.
For every option you select, the effect is shown immediately in the preview pane at the bottom of the dialog.
•Inline Array: Displays the items of an array in a single line (or inline). Otherwise the items might be on separate lines. You can choose to never apply inline formatting to arrays, or to apply inline formatting to empty arrays or arrays up to a specific size.
•Inline Object: Displays the properties of an object in a single line (or inline). Otherwise the properties might be on separate lines. You can choose to never apply inline formatting to objects, or to apply inline formatting to empty objects or objects that have up to a specified number of properties.
•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 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).
You can specify via the check box above the pane whether to use the indentation specified in the Text View Settings dialog or whether to use no indentation at all.
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.
After making the settings, click OK to finish.