public static String cleanupEscapedCharForXML(char escapedChar,String toClean){
  if (toClean == null || toClean.indexOf(escapedChar) == -1 || toClean.indexOf('\\') == -1) {
    return toClean;
  }
  StringBuilder buf=new StringBuilder(toClean.length());
  char[] chars=toClean.toCharArray();
  int i;
  for (i=0; i < chars.length - 1; ++i) {
    if (chars[i] != '\\' || chars[i + 1] != escapedChar) {
      buf.append(chars[i]);
    }
 else {
      buf.append("&#x" + Integer.toString((chars[i + 1]),16) + ";");
      i++;
    }
  }
  if (i == chars.length - 1) {
    buf.append(chars[chars.length - 1]);
  }
  return buf.toString();
}

public static String cleanupEscapedCharForXML ( char escapedChar , String toClean ) { if ( toClean == null || toClean . indexOf ( escapedChar ) == - 1 || toClean . indexOf ( '\\' ) == - 1 ) { return toClean ; } StringBuilder buf = new StringBuilder ( toClean . length ( ) ) ; char [ ] chars = toClean . toCharArray ( ) ; int i ; for ( i = 0 ; i < chars . length - 1 ; ++ i ) { if ( chars [ i ] != '\\' || chars [ i + 1 ] != escapedChar ) { buf . append ( chars [ i ] ) ; } else { buf . append ( "&#x" + Integer . toString ( ( chars [ i + 1 ] ) , 16 ) + ";" ) ; i ++ ; } } if ( i == chars . length - 1 ) { buf . append ( chars [ chars . length - 1 ] ) ; } return buf . toString ( ) ; }
get rid of backslashes that were escaping the specified character
