Please enable JavaScript to view this site.

Altova XMLSpy 2020 Enterprise Edition

In this section, you will learn how to set up a "pretty-printed" document and how to use bookmarks while editing. When a document is pretty-printed it is displayed in Text View so that each lower level in the XML hierarchy is indented deeper than the previous level (see screenshot below). Bookmarks enable you to mark document positions that you wish to return to quickly.




Pretty-printing involves two steps: (i) Setting pretty-printing on and specifying the amount of indentation, and (ii) applying pretty-printing.


1.Open the file CompanyFirst.xml, which is in the C:\Documents and Settings\<username>\My Documents\Altova\XMLSpy2020\Examples\Tutorial folder (and switch to Text View if Text View is not the default starting view of XML documents).

2.In the View section of the Options dialog (Tools | Options | View, screenshot below), check the Use Indentation check box. This switches on pretty-printing with indentation (the default setting). Click OK when done. Note that this setting will apply to all files opened in Text View.


3.Open the Text View Settings dialog (with the View | Text View Settings command, screenshot below) and in the Tabs pane, decrease the Tab size to 3. Leave the default selection of the Insert Tabs radio button as it is. This will cause the pretty-printing indent to be a tab (rather than spaces) and each tab will have a width of three spaces. Click OK when done.

4.Click the menu command Edit | Pretty-Print. The document will be pretty-printed with the new tab values.

5.Open the Text View Settings dialog (View | Text View Settings) and, in the Visual Aid pane, switch on the end-of-line markers.

6.In Text View, go to the end of any line and delete the end-of-line marker so that the next line jumps up a line.

7.Switch to Grid View and back again to Text View. The document will be pretty-printed, and the the end-of-line marker you deleted will be reinstated.


Note:If, in the View section of the Options dialog (Tools | Options | View, screenshot above), you uncheck the Use Indentations check box and then pretty-print all lines will begin without any indentation.



Bookmarks are placed in a bookmark margin on the left of lines you wish to mark. You can then quickly move up and down through the bookmarks in your document.


1.In the Text View Settings dialog (View | Text View Settings, screenshot below) ensure that the Bookmarks Margin option in the Margins pane is selected. Click OK when done.


2.In Text View of the file CompanyFirst.xml, place the cursor anywhere in a line you wish to bookmark, then select the menu command Edit | Insert/Remove Bookmark. The line will be bookmarked and is indicated with a blue bookmark in the bookmark margin (see screenshot below).

3.Create a bookmark on another line in the same way as in Step 2.


4.Press F2 (or the command Edit | Go to Next Bookmark) to go down the document to the next bookmark. Press Shift+F2 (or the command Edit | Go to Previous Bookmark) to go up the document to the previous bookmark. Repeat either or both commands as many times as you like.

5.Place the cursor in one of the bookmarked lines and select the menu command Edit | Insert/Remove Bookmark. The bookmark is removed.

6.Save and close the file. No bookmark information is saved with the file. Reopen the file to check this.


© 2020 Altova GmbH