Jun 20 2008

Formatting XML with gedit and tidy

Published by tylere under Geospatial Technologies

Ever since I moved to Ubuntu, I have been wondering how to format (i.e. auto-indent) files for XML-based languages. With Ubuntu, I primarily use gedit for editing configuration files, but it does not have this formatting ability by default. When I edit XML configuration files, I have a tendency to muck up the indention while editing them. In the old days with Windows, I used Textpad which could format XML files after I had messed with them.

Today I found a post on customizing gedit that included a section on ‘Beautifying HTML’ using gedit’s ‘external tools’ plugin. Within minor changes to the external tools configuration, I can now ‘Beautify XML’ in gedit.

Here are parameters for the External Tools configuration:

Name: Beautify XML
Description: Beautify XML using Tidy
Commands: tidy -utf8 -xml -w 255 -i -c -q -asxml
Input: Current document
Output: Create new document
Applicability: All documents

No responses yet