在数据库中,我有一个消息模板,该消息模板的字符串中包含"it's"
,所以当我将该消息模板制成XML格式时,我在xml标记中得到了it's
。
sms.setMessage(createSMS.messageFormatter(sms).getMessage());
tagList = new TagList[4];
req.setTaglist(tagList);
tagList[0] = new TagList();
tagList[0].setTagName("OA");
tagList[0].setTagValue(dto.getDaInk());
tagList[1] = new TagList();
tagList[1].setTagName("DA");
sms.setMsisdnTosent(Utilities.appendCountryCode(sms.getMsisdnTosent()));
tagList[1].setTagValue(sms.getMsisdnTosent());
tagList[2] = new TagList();
tagList[2].setTagName("MESSAGE");
tagList[2].setTagValue(sms.getMessage());
tagList[3] = new TagList();
tagList[3].setTagName(Tags.TONE_ID);
tagList[3].setTagValue(sms.getSongId());
我越来越喜欢
<tagData>
<name>MESSAGE</name>
<value>Dear customer it""s a confirmation messege sent to activate Tune ALLAHUMMA EGHFER LE ABAENA WA OMMAHATENA you just heard Latest,reply with * to copy the Tune, of artist AL SHEIKH MAHER BIN HAMAD AL MUAIQLY and toneId is 176577,cndtn aply.</value>
</tagData>
但是我想将it""s
替换为it's
答案 0 :(得分:1)
按照yash的建议,您可以在编辑xml变量之前在其xml变量上使用org.apache.commons.lang.StringEscapeUtils:
StringEscapeUtils.unescapeXml(xml);