Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 446
Nicholas DiPiazza Avatar asked Jul 21 '15 10:07

Nicholas DiPiazza


1 Answers

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.

like image 166
Nicholas DiPiazza Avatar answered Sep 24 '22 19:09

Nicholas DiPiazza