eclipsexml-editor

Eclipse XML formatter adds whitspace inside elements


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.


Solution

  • 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.