fix(接口定义): 修复xml 格式化没有数据时出现换行问题

This commit is contained in:
fit2-zhao 2021-07-02 17:29:27 +08:00 committed by fit2-zhao
parent 0ae630c5f4
commit cab191ae2a
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ export function formatXml(text) {
//去掉多余的空格
text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
return name + ' ' + props.replace(/\s+(\w+=)/g, " $1");
}).replace(/>\s*?</g, ">\n<");
});
//把注释编码
text = text.replace(/<!--(.+?)-->/g, function ($0, text) {
var ret = '<!--' + escape(text) + '-->';