Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Eclipse XML formatting?

Tags:

xml

eclipse

I would like to change the way Eclipse formats XML files. For example, if I have in pom.xml file a section as follows:

    <dependency>         <groupId>junit</groupId>         <artifactId>junit</artifactId>         <version>3.8.1</version>         <scope>test</scope>     </dependency> 

After ctrl+shift+f it will look like:

    <dependency>         <groupId>             junit         </groupId>         <artifactId>             junit         </artifactId>         <version>             3.8.1         </version>         <scope>             test         </scope>     </dependency> 

I prefer the first version, so how to configure Eclipse to format XML files to look like that?

like image 360
tputkonen Avatar asked May 31 '10 11:05

tputkonen


People also ask

How do I import code formatter XML into Eclipse?

All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.


1 Answers

Window -> Preferences, then XML -> XML Files -> Editor. There is a search box above the preferences tree, very useful when you want to find where something is configured.

Note that it may be some other editor is used, e.g. if you're editing a build.xml file and have the Ant integration. In this specific case you'd set up the formatting at Window -> Preferences, Ant -> Editor -> Formatter. In similiar cases you need to search for the corresponding options for that editor yourself.

like image 146
unbeli Avatar answered Sep 25 '22 03:09

unbeli