Format Preferences

This preferences page contains various formatting options that influence editing and formatting in both the Text and Author editing modes. To control additional options specifically for the Author mode editor, see Whitespace Handling in Author Mode.

Note: These settings apply to the formatting of source documents. The formatting of output documents is determined by the transformation scenarios that create them.

To configure the Format options, open the Preferences dialog box (Options > Preferences) and go to Editor > Format.

The following options are available:
Detect indent on open
If selected, Oxygen XML Editor detects how a document is indented when it is opened. Oxygen XML Editor uses a heuristic method of detection by computing a weighted average indent value from the initial document content. You can disable this setting if the detected value does not work for your particular case and you want to use a fixed-size indent for all the edited documents. If this option is enabled, Oxygen XML Editor detects the following:
  • When TAB characters are used to indent content, the size of the TAB characters is used for the indent size.
  • Otherwise, the detected size of SPACE characters is used for the indent size.
Tip: If you want to minimize the formatting differences created by the Format and Indent operation in a document edited in the Text edited mode, make sure that both the Detect indent on open and Detect line width on open options are enabled.
Use zero-indent, if detected
By default, if no indent was detected in the document, the fixed-size indent is used. Enable this option if all your document have no indentation and you want to keep them that way.
Indent with tabs
If selected, indents are created using TAB characters. If unchecked, lines are indented using space characters. Selecting this option automatically disables the Detect indent on open option.
Indent size
The meaning of this setting depends on the following:
  • If the Detect indent on open option is enabled and TAB characters are detected at the beginning of the line, the indent size is the width of a TAB character. Otherwise, the indent size value is ignored and Oxygen XML Editor uses the number of detected SPACE characters.
  • If the Indent with tabs option is selected, the indent size is the width of a TAB character.
  • If neither of these options are enabled, the indent size is the number of SPACE characters used for indenting the text lines.

For additional information about changing the indent size, see the Setting an Indent Size to Zero topic.

For information about when this setting is used, see the When Indent Size and Line Width Settings are Used in Oxygen XML Editor section.

Hard line wrap (Limit to "Line width - Format and Indent")
If enabled, when typing content in the Text editing mode and the maximum line width is reached, a line break is automatically inserted.
Indent on enter
If disabled, when you press the Enter key to insert a line break in the Textediting mode, no indentation will be added to the new line.
Enable smart enter
If selected, when you press the Enter key between a start and an end XML tag in the Text editing mode, the cursor is placed in an indented position on the empty line formed between the start and end tag.
Detect line width on open
If enabled, Oxygen XML Editor automatically detects the line width when the document is opened.
Format and indent the document on open
If enabled, an XML document is formatted and indented before opening it in Oxygen XML Editor.
Line width - Format and Indent
Defines the number of characters after which the Format and Indent (pretty-print) action performs hard line-wrapping. For example, if set to 100, after a Format and Indent action, the longest line will have a maximum of 100 characters. This setting is also used when saving XML content edited in the Author editing mode.
Note: To avoid having an indent that is longer than the line width setting and without having sufficient space available for the text content, the indent limit is actually set at half the value of the Line width - Format and Indent setting. The remaining space is reserved for text.
For information about when this setting is used, see the When Indent Size and Line Width Settings are Used in Oxygen XML Editor section.
Clear undo buffer before Format and Indent
The Format and Indent operation can be undone, but if used intensively, a considerable amount of the memory allocated for Oxygen XML Editor will be used for storing the undo states. If this option is selected, Oxygen XML Editor empties the undo buffer before doing a Format and Indent operation. This means you will not be able to undo any changes you made before the format and indent operation. Select this option if you encounter out of memory problems (OutOfMemoryError) when performing the Format and Indent operation.

When Indent Size and Line Width Settings are Used in Oxygen XML Editor

The values set in the Indent Size and Line Width - Format and Indent options are used in various places in the application, including the following:
  • When the Format and Indent action is used in the Text editing mode.
  • When you press ENTER to break a line in the Text editing mode.
  • When the Hard line wrap (Limit to "Line width - Format and Indent") option is enabled and the maximum line width is reached while editing in the Text mode.
  • When the XML is serialized by saving content in the Author editing mode.

To watch our video demonstration about the formatting options offered by Oxygen XML Editor, go to http://oxygenxml.com/demo/Autodetect_Formating.html.