fix(测试跟踪): 脑图导入 Xmind 处理 xml 反转义问题

--bug=1021356 --user=周骏弘 【测试跟踪】github #20468,导入脑图,反转义失败 https://www.tapd.cn/55049933/s/1344675
This commit is contained in:
junhong 2023-03-01 18:38:53 +08:00 committed by jianxing
parent 3c4ca39e16
commit a1ab0c837b
1 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.xmind.parser;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.utils.XmlUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@ -33,9 +34,12 @@ public class XmindLegacy {
// 删除content.xml里面不能识别的字符串
xmlContent = xmlContent.replace("xmlns=\"urn:xmind:xmap:xmlns:content:2.0\"", StringUtils.EMPTY);
xmlContent = xmlContent.replace("xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"", StringUtils.EMPTY);
try {
xmlContent = removeTopicsFromString(xmlContent);
// 反转义 xml 中的 < > 字符
xmlContent = StringEscapeUtils.unescapeXml(xmlContent);
xmlContent = xmlContent.replace("&gt;", ">");
xmlContent = xmlContent.replace("&lt;", "<");
} catch (Exception e) {
LogUtil.error("移除xml中的Topic出错", e);
}