question: public static String xmlComment ( String data ) { int idx = 0 ; while ( true ) { idx = data . indexOf ( "--" , idx ) ; if ( idx < 0 ) { break ; } data = data . substring ( 0 , idx + 1 ) + " " + data . substring ( idx + 1 ) ; } if ( data . indexOf ( '\n' ) >= 0 ) { return "<!--\n" + indent ( data ) + "-->\n" ; } return "<!-- " + data + " -->\n" ; }
target:  Escapes a comment. If the data contains '--', it is converted to '- -'. The data is indented with 4 spaces if it contains a newline character.