public static String escapeXml ( String str ) { if ( str == null ) { return null ; } return EntitiesUtils . XML . escape ( str ) ; }
< p > Escapes the characters in a < code > String < /code > using XML entities. < /p > < p > For example : < tt > '' bread '' & `` butter '' < /tt > = > < tt > & amp ; quot ; bread & amp ; quot ; & amp ; amp ; & amp ; quot ; butter & amp ; quot ; < /tt > . < /p > < p > Supports only the five basic XML entities ( gt , lt , quot , amp , apos ) . Does not support DTDs or external entities. < /p > < p > Note that unicode characters greater than 0x7f are currently escaped to their numerical \\u equivalent . This may change in future releases . < /p >