8

Eclipse's XML formatter does something rather annoying.

It turns this:

<timestamp>2009-10-20 00:00:00.000</timestamp>

Into

<timestamp>2009-10-20 00:00:00.000
</timestamp>

Quite harmless typically except with, for example, Apache CXF who will now try to parse the whitespace in the timestamp and will throw parse exceptions!

How can I get it to stop doing this? Everything else about Eclipse's XML formatter works awesome.

Note: This question is not a duplicate of Eclipse XML formatter inserts unneeded line breaks This one references android XML editor which I'm not using.

Community
  • 1
  • 1
Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
  • I can't reproduce this with the latest Eclipse release (Mars). Can you add a screenshot of your **Preferences** > **XML** > **XML Files** > **Editor**? – E-Riz Jul 24 '15 at 14:59
  • I'm using all the Eclipse Mars defaults. – Nicholas DiPiazza Jul 24 '15 at 15:08
  • 1
    The preferences are stored with the workspace, and I can't reproduce with a brand new workspace created with Mars. Can you think of anything else that might be affecting the behavior? Can you post with a complete XML file that exhibits the problem for you? – E-Riz Jul 24 '15 at 15:15

1 Answers1

2

I figured it out. It was the "new line" functionality. Eclipse takes it upon itself to add new lines to the XML even when inside an element if past the "max characters per line." When I increased the character count to 9999 it fixed the issue.

Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152