String convertToEntity(String input){
  String output=input.replaceAll("&","&amp;");
  output=output.replaceAll("<","&lt;");
  output=output.replaceAll(">","&gt;");
  return output;
}

String convertToEntity ( String input ) { String output = input . replaceAll ( "&" , "&amp;" ) ; output = output . replaceAll ( "<" , "&lt;" ) ; output = output . replaceAll ( ">" , "&gt;" ) ; return output ; }
escapes xml symbols symbols to html entities
