public static String decodeString(String strData) { strData = replaceString(strData, "<", "<"); return strData; } public static String replaceString(String strData, String regex, String replacement) { if (strData == null) { return null; } int index; index = strData.IndexOf(regex); String strNew = ""; if (index >= 0) { while (index >= 0) { strNew += strData.Substring(0, index) + replacement; strData = strData.Substring(index + regex.Length); index = strData.IndexOf(regex); } strNew += strData; return strNew; } return strData; }
把尖括号转义,传过去的时候就是字符串了,但是不会影响接收方对xml的操作。