List of utility methods to do XML Encode
byte[] | xmlEncode(byte[] str) xml Encode byte[] ret = new byte[0]; for (int i = 0; i < str.length; i++) { if ((str[i] & 0xFF) >= 128 || (str[i] & 0xFF) < 32 || (str[i] & 0xFF) == '\'' || (str[i] & 0xFF) == '<' || (str[i] & 0xFF) == '>' || (str[i] & 0xFF) == '"') { String entity = "&#x" + String.format("%02X", str[i]) + ";"; ret = concat(ret, entity.getBytes()); } else ... |
String | xmlEncode(String str) xml Encode String ret = ""; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c >= 128 || c < 32 || c == '\'' || c == '"' || c == '<' || c == '>') { if (c > 0xFF) ret += "&#x" + String.format("%04x", (int) c) + ";"; else ... |