You are in the right way, but first of all, you have to customize the XML format:
- Open
Window > Preferences > XML > XML files > Editor. - Check
format commentsand uncheckJoin lines. (This should indent comments and remove adjacent blanks and so, preserving the existing newlines. But if you feel uncomfortable with the result, uncheckformat comments.) - Select
Indent using spacesand set theindentation size.
Now you can format your XML files by pressing [SHIFT][CTRL][F].
