Thanks, this is exactly what I was looking for. But as a quick fix I had also written a method whichis simlar to this API that this util provides -
escapeXml
public static String escapeXml(String str)
Escapes the characters in a String using XML entities.
For example: "bread" & "butter" => "bread" & "butter".
Supports only the five basic XML entities (gt, lt, quot, amp, apos). Does not support DTDs or external entities.
Parameters:
str - the String to escape, may be null
Returns:
a new escaped String, null if null string input
See Also:
unescapeXml(java.lang.String)
- Manish