public static String XmlFilter(boolean isSoapReq, String value) { if ((value == null) || value.equals("")) { // do not use StringTools.isBlank (spaces are significant) return ""; } else if (StringTools.isAlphaNumeric(value, XML_CHARS)) { return value; // return all significant spaces } else { String v = StringTools.replace(value, "\n", "\\n"); return XMLTools.CDATA(isSoapReq, v); } }
/** * ** Converts "\\n" patterns into literal newlines (\n) ** @param s The StringBuffer to convert * "\\n" to "\n" ** @return The decoded StringBuffer */ protected static StringBuffer decodeNewLine(StringBuffer s) { return StringTools.replace(s, "\\n", "\n"); }