problems with XML formatting in eclipse
Have you ever had problems with source code formating and xml files with large blocks of text content? Here is the way to go to go:
Are you using iBATIS sqlmaps or any other technology heavily based on sql statements in XML files? With ibatis I quite often create complex sql queries in PL/SQL Developer, format them nicely there and paste them into my ibatis mapping file. The xml file looks quite nice after that but what happens if you use the source code formatting feature of eclipse (Ctrl+Shift+F)? Correct - the sql formatting is lost!
The solution to this problem is the usage of the CDATA element:
The ibatis mapping example stays the same even after the document is reformated. Withouth the CDATA it would look like this after formatting: