String str = "<ROOT><FILEBODY>00001|张三四</FILEBODY></ROOT>";String str1 = str.replace("<FILEBODY>","\r\n"+"<FILEBODY>" + "\r\n") ;String str2 = str1.replace("</FILEBODY>","</FILEBODY>" + "\r\n") ;不用replace()方法 发送xml报文时中文字符编码不会出现乱码使用replace()方法后发送xml报文时导致中文字符编码出现乱码