public static String unescape ( String string ) { StringBuilder sb = new StringBuilder ( string . length ( ) ) ; for ( int i = 0 , length = string . length ( ) ; i < length ; i ++ ) { char c = string . charAt ( i ) ; if ( c == ' ' ) { final int semic = string . indexOf ( ' ' , i ) ; if ( semic > i ) { final String entity = string . substring ( i + 1 , semic ) ; sb . append ( XMLTokener . unescapeEntity ( entity ) ) ; // skip past the entity we just parsed. i += entity . length ( ) + 1 ; } else { // this shouldn't happen in most cases since the parser // errors on unclosed entries. sb . append ( c ) ; } } else { // not part of an entity sb . append ( c ) ; } } return sb . toString ( ) ; }
Removes XML escapes from the string .