public static String removeInvalidXMLChars(String text){
  if (text == null || text.isEmpty()) {
    return text;
  }
  return text.replaceAll(INVALID_XML_CHARACTERS,"");
}

public static String removeInvalidXMLChars ( String text ) { if ( text == null || text . isEmpty ( ) ) { return text ; } return text . replaceAll ( INVALID_XML_CHARACTERS , "" ) ; }
remove invalid xml characters from a string .
