Accepted answer


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

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


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.


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.


cmd + shift + f for macintosh users


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


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