public static String replaceAll(String source){
  int regionStart=0;
  for (String entity=getNextEntity(source,regionStart); entity != null; entity=getNextEntity(source,regionStart)) {
    String replacement=EntityMap.get(entity);
    if (replacement == null) {
      regionStart+=entity.length();
      continue;
    }
    source=source.replace(entity,replacement);
    regionStart+=replacement.length();
  }
  return source;
}

public static String replaceAll ( String source ) { int regionStart = 0 ; for ( String entity = getNextEntity ( source , regionStart ) ; entity != null ; entity = getNextEntity ( source , regionStart ) ) { String replacement = EntityMap . get ( entity ) ; if ( replacement == null ) { regionStart += entity . length ( ) ; continue ; } source = source . replace ( entity , replacement ) ; regionStart += replacement . length ( ) ; } return source ; }
replaces all entities and character references in a specified string .
