Formatting in Text View

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > Editing Views > Text View >

Formatting in Text View

Text View offers a number of text formatting options. These are listed below.

 

Fonts

The font-family, font-size, font-style, and text background-color can be customized separately for the following groups of documents: (i) generic XML documents (including HTML); (ii) XQuery documents; and (iii) CSS documents.

 

Text items in a document that have different semantics, can be colored differently. For example, you can color element names, attribute names, and element content differently. When you set different colors for different text items, the syntax-coloring feature is enabled. Text fonts are customized in the Fonts and Colors section of the Options dialog.

 

Indentation

TextViewIndentation

To display the document in this way, you need to do the following:

 

1.In the View section of the Options dialog, check the Use Indentation option for pretty printing. This will cause the document to be pretty-printed with indents to indicate the hierarchical structure. Each deeper level will be displayed with a deeper indent than its parent element. If the Use Indentation option is not checked, every line in the document will start with a zero indent.
2.In the Text View Settings dialog (View | Text View Settings; screenshot below), select either Insert Tabs or Insert Spaces. This determines whether tabs or spaces will be used for indentation when the document is pretty-printed. If spaces are specified, each deeper level of the hierarchy is indented with an additional number of spaces as specified in the Tab Size setting of the Text View Settings dialog.

TextViewSettingsDlg

3.Click the Edit | Pretty-Print XML Text command or the Pretty Print icon in the Text toolbar. This will cause the document text to be displayed (i) with or without indentation as specified in the View section of the Options dialog; and (ii) if indentation is specified in the View section of the Options dialog, then the the indentation is determined by the settings in the Tabs pane of the Text View Settings dialog. Clicking the Pretty Print command removes unnecessary leading or trailing whitespace.

 

Note:Pretty-printing is also used in the background when you save the document or switch views. If the document is not well-formed, you will get an error message to that effect. Correct the error and then pretty-print. The extent of indentation of a line is indicated by indentation guides, which are vertical dotted lines (see screenshot at the start of this section) that are toggled on and off with the Indentation Guides check box in the Visual Aid pane of the Text View Settings dialog (see screenshot above).

 

Using tabs and spaces for formatting

You can use tabs and spaces for formatting text, especially for non-XML documents, where the pretty-printing option is not available. When you press Return or Shift+Return, the cursor will jump to a position on the next line that corresponds to the starting position of the previous line.

 

Word-wrapping

Lines of text that are longer than the breadth of the Main Window can be made to wrap by toggling the View | Word Wrap command on; the corresponding icon is in the Text toolbar.

 


© 2019 Altova GmbH