public static String encode ( final String input ) { if ( input == null || input . length ( ) == 0 ) { return input ; } return ENCODE . translate ( input ) ; }
Encode all the special characters found in the given string to their escape sequences according to the XML specification and returns the resultant string . Eg . cat&amp ; dog &gt ; ant becomes cat&amp ; amp ; dog &amp ; gt ; ant .