score:120

Accepted answer

ctrl+shift+f

will do it for you, and you can configure it in

window -> preferences -> xml -> xml files -> editor

score:-1

you can set the default xml editor to “java editor”:

  • right-click on the xml
  • open with
  • other...
  • java editor

this applies all java formatting and controls over xml file.

score:3

open windows->preferences->xml files->editor enter some high number for line width, say 999 and then format the xml file with ctrl+shift+f.

you ll see the lines are aligned properly.

score:14

cmd + shift + f for macintosh users

score:15

you need to open the file using the xml editor, swap to source view and then do the ctrl + shift + f trick.

score:38

as stated above, ctrl+shift+f will auto-format. however, by default eclipse will split attributes in a naive way. if you're like me and prefer to have all the attributes on their own lines, go to window→preferences→xml→xml files→editor and check split multiple attributes each on a new line.


Related Query

More Query from same tag