我使用百里香th:attr
标签来解析xml。示例:
<erp th:attr="IS_START_MONTH=false,ITYPE_ID=${itypeId},NAME=${unitName},P_ID=${pcode},START_DATE=${startDate},CORRELATION_TOKEN=${correlationId}">
但是当我查看输出时,发现以下结果:
<erp IS_START_MONTH="false" ITYPE_ID="VP" FZ_ID="294" NAME="Отдел надзорной деятельности и профилактической работы по Ростовскому, Борисоглебскому и Гаврилов-Ямскому районам Ярославской области" START_DATE="26-09-2018" CORRELATION_TOKEN="3b765361-e586-417d-aba0-ca49d2ec7ea2">
因此所有替换的西里尔字母值都变为html转义。
我使用此百里香叶配置:
@Bean
ITemplateResolver xmlTemplateResolver() {
ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setResolvablePatterns(Collections.singleton("xml/*"));
templateResolver.setPrefix("/templates/");
templateResolver.setSuffix(".xml");
templateResolver.setTemplateMode("XML");
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
return templateResolver;
}