static String unescapeEntity ( String e ) { // validate if ( e == null || e . isEmpty ( ) ) { return "" ; } // if our entity is an encoded unicode point, parse it. if ( e . charAt ( 0 ) == ' ' ) { int cp ; if ( e . charAt ( 1 ) == ' ' ) { // hex encoded unicode cp = Integer . parseInt ( e . substring ( 2 ) , 16 ) ; } else { // decimal encoded unicode cp = Integer . parseInt ( e . substring ( 1 ) ) ; } return new String ( new int [ ] { cp } , 0 , 1 ) ; } Character knownEntity = entity . get ( e ) ; if ( knownEntity == null ) { // we don't know the entity so keep it encoded return ' ' + e + ' ' ; } return knownEntity . toString ( ) ; }
Unescapes an XML entity encoding ;