String (String text) { if (text == null) return null; String offensiveChars = "<>&"; for (int i = 0; i < offensiveChars.length(); i++) { char c = offensiveChars.charAt(i); if (text.indexOf(c) != -1) { return "<![CDATA[" + text + "]]>"; } } return text; }