Pretty-Print

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

Home >  User Guide and Reference > Menu Commands > Edit Menu >

Pretty-Print

Icon

 

Icon:

ic_pretty_print

 

Description

The Pretty-Print command re-formats your XML document in Text View. Two formatting options are available: which one is used depends upon whether the Use Indentation check box in the View section of the Options dialog (Tools | Options) is currently checked or not:

 

Use Indentation checked: The document is re-formatted to give a structured display, indenting each deeper level in the hierarchy by an additional amount of the specified indentation space (this space being specified in the Text View Settings dialog (View | Text View Settings)). Indentation enables a clearer view of the document structure.
Use Indentation unchecked: The document is re-formatted so that each new line is left-aligned.

 

Procedure for using Pretty-Print

To set up a structured, indented view of the XML document via Pretty-Print, do the following:

 

1.In the View section of the Options dialog (Tools | Options), check the Use Indentation check box.
2.In the Text View Settings dialog (View | Text View Settings), set the tab size you want for the indentation of the pretty-printed text.
3.In the File section of the Options dialog (Tools | Options), enter the elements for which no output formatting (indentation) is wanted.
4.Click the Pretty-Print command (this command).

 

To re-format the document so that all lines are left-aligned, uncheck the Use Indentation check box.

 

Note the following points        

 

The XML document must be well-formed for this command to work.
Pretty-printing adds spaces or tabs to the document when the document is saved.
If pretty-printing has been switched on (Tools | Options | View | Use Indentation) and if you change from Text View to Grid View and back to Text View, then the document will be pretty-printed automatically. There is no need to select the Pretty-Print command.
To remove all whitespace (new lines and indentation) created with the Pretty-Print command, use the Strip Whitespaces command.

 


© 2019 Altova GmbH